aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runit/svlogd.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/runit/svlogd.c b/runit/svlogd.c
index 3ed13b67b..795bf48bb 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -137,9 +137,9 @@ log message, you can use a pattern like this instead
137//kbuild:lib-$(CONFIG_SVLOGD) += svlogd.o 137//kbuild:lib-$(CONFIG_SVLOGD) += svlogd.o
138 138
139//usage:#define svlogd_trivial_usage 139//usage:#define svlogd_trivial_usage
140//usage: "[-ttv] [-r C] [-R CHARS] [-l MATCHLEN] [-b BUFLEN] DIR..." 140//usage: "[-tttv] [-r C] [-R CHARS] [-l MATCHLEN] [-b BUFLEN] DIR..."
141//usage:#define svlogd_full_usage "\n\n" 141//usage:#define svlogd_full_usage "\n\n"
142//usage: "Continuously read log data from stdin and write to rotated log files in DIRs" 142//usage: "Read log data from stdin and write to rotated log files in DIRs"
143//usage: "\n" 143//usage: "\n"
144//usage: "\n""DIR/config file modifies behavior:" 144//usage: "\n""DIR/config file modifies behavior:"
145//usage: "\n""sSIZE - when to rotate logs" 145//usage: "\n""sSIZE - when to rotate logs"
@@ -339,17 +339,18 @@ static unsigned pmatch(const char *p, const char *s, unsigned len)
339/*** ex fmt_ptime.[ch] ***/ 339/*** ex fmt_ptime.[ch] ***/
340 340
341/* NUL terminated */ 341/* NUL terminated */
342static void fmt_time_human_30nul(char *s) 342static void fmt_time_human_30nul(char *s, char dt_delim)
343{ 343{
344 struct tm *ptm; 344 struct tm *ptm;
345 struct timeval tv; 345 struct timeval tv;
346 346
347 gettimeofday(&tv, NULL); 347 gettimeofday(&tv, NULL);
348 ptm = gmtime(&tv.tv_sec); 348 ptm = gmtime(&tv.tv_sec);
349 sprintf(s, "%04u-%02u-%02u_%02u:%02u:%02u.%06u000", 349 sprintf(s, "%04u-%02u-%02u%c%02u:%02u:%02u.%06u000",
350 (unsigned)(1900 + ptm->tm_year), 350 (unsigned)(1900 + ptm->tm_year),
351 (unsigned)(ptm->tm_mon + 1), 351 (unsigned)(ptm->tm_mon + 1),
352 (unsigned)(ptm->tm_mday), 352 (unsigned)(ptm->tm_mday),
353 dt_delim,
353 (unsigned)(ptm->tm_hour), 354 (unsigned)(ptm->tm_hour),
354 (unsigned)(ptm->tm_min), 355 (unsigned)(ptm->tm_min),
355 (unsigned)(ptm->tm_sec), 356 (unsigned)(ptm->tm_sec),
@@ -1160,8 +1161,8 @@ int svlogd_main(int argc, char **argv)
1160 if (timestamp) { 1161 if (timestamp) {
1161 if (timestamp == 1) 1162 if (timestamp == 1)
1162 fmt_time_bernstein_25(stamp); 1163 fmt_time_bernstein_25(stamp);
1163 else /* 2: */ 1164 else /* 2+: */
1164 fmt_time_human_30nul(stamp); 1165 fmt_time_human_30nul(stamp, timestamp == 2 ? '_' : 'T');
1165 printlen += 26; 1166 printlen += 26;
1166 printptr -= 26; 1167 printptr -= 26;
1167 memcpy(printptr, stamp, 25); 1168 memcpy(printptr, stamp, 25);