aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2013-04-03 13:02:14 +0100
committerRon Yorston <rmy@pobox.com>2013-04-03 13:02:14 +0100
commit667d5dd0a428a790df5a73d044cf9a8882ee92f8 (patch)
tree76291debc380e8d31991c3d2eddcf0add131c7a3 /procps
parent8782950636f76faa8db0ed8c5d698ab0bd1fbf45 (diff)
parentd35cbad0efaa57bf7c5280e62825966f7757906a (diff)
downloadbusybox-w32-667d5dd0a428a790df5a73d044cf9a8882ee92f8.tar.gz
busybox-w32-667d5dd0a428a790df5a73d044cf9a8882ee92f8.tar.bz2
busybox-w32-667d5dd0a428a790df5a73d044cf9a8882ee92f8.zip
Merge branch 'busybox' into merge
Conflicts: libbb/lineedit.c
Diffstat (limited to 'procps')
-rw-r--r--procps/watch.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/procps/watch.c b/procps/watch.c
index 36af1cca7..0397f21bf 100644
--- a/procps/watch.c
+++ b/procps/watch.c
@@ -69,7 +69,6 @@ int watch_main(int argc UNUSED_PARAM, char **argv)
69 printf("\033[H""\033[J"); 69 printf("\033[H""\033[J");
70 if (!(opt & 0x2)) { // no -t 70 if (!(opt & 0x2)) { // no -t
71 const unsigned time_len = sizeof("1234-67-90 23:56:89"); 71 const unsigned time_len = sizeof("1234-67-90 23:56:89");
72 time_t t;
73 72
74 // STDERR_FILENO is procps3 compat: 73 // STDERR_FILENO is procps3 compat:
75 // "watch ls 2>/dev/null" does not detect tty size 74 // "watch ls 2>/dev/null" does not detect tty size
@@ -79,10 +78,13 @@ int watch_main(int argc UNUSED_PARAM, char **argv)
79 free(header); 78 free(header);
80 header = xasprintf("Every %us: %-*s", period, (int)width, cmd); 79 header = xasprintf("Every %us: %-*s", period, (int)width, cmd);
81 } 80 }
82 time(&t); 81 if (time_len < width) {
83 if (time_len < width) 82 strftime_YYYYMMDDHHMMSS(
84 strftime(header + width - time_len, time_len, 83 header + width - time_len,
85 "%Y-%m-%d %H:%M:%S", localtime(&t)); 84 time_len,
85 /*time_t*:*/ NULL
86 );
87 }
86 88
87 // compat: empty line between header and cmd output 89 // compat: empty line between header and cmd output
88 printf("%s\n\n", header); 90 printf("%s\n\n", header);