diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-11-07 11:49:25 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-11-07 22:49:09 -0500 |
commit | 70887c5f2956f2e8c4f58563535049149db98fc2 (patch) | |
tree | 588c15c0971937cd9353fcae09fd0bcde98a0c55 /src/shared | |
parent | 5206a724a0a022dab8159a28ddd72d7d30e81c9c (diff) |
tree-wide: add PRI_[NU]SEC, and use time format strings more
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/logs-show.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 99b76714e0..75ea25c8ac 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -223,10 +223,7 @@ static int output_timestamp_monotonic(FILE *f, sd_journal *j, const char *monoto if (r < 0) return log_error_errno(r, "Failed to get monotonic timestamp: %m"); - fprintf(f, "[%5llu.%06llu]", - (unsigned long long) (t / USEC_PER_SEC), - (unsigned long long) (t % USEC_PER_SEC)); - + fprintf(f, "[%5"PRI_USEC".%06"PRI_USEC"]", t / USEC_PER_SEC, t % USEC_PER_SEC); return 1 + 5 + 1 + 6 + 1; } @@ -268,7 +265,7 @@ static int output_timestamp_realtime(FILE *f, sd_journal *j, OutputMode mode, Ou switch (mode) { case OUTPUT_SHORT_UNIX: - xsprintf(buf, "%10llu.%06llu", (unsigned long long) t, (unsigned long long) (x % USEC_PER_SEC)); + xsprintf(buf, "%10"PRI_TIME".%06"PRIu64, t, x % USEC_PER_SEC); break; case OUTPUT_SHORT_ISO: @@ -292,7 +289,7 @@ static int output_timestamp_realtime(FILE *f, sd_journal *j, OutputMode mode, Ou assert(sizeof(buf) > strlen(buf)); k = sizeof(buf) - strlen(buf); - r = snprintf(buf + strlen(buf), k, ".%06llu", (unsigned long long) (x % USEC_PER_SEC)); + r = snprintf(buf + strlen(buf), k, ".%06"PRIu64, x % USEC_PER_SEC); if (r <= 0 || (size_t) r >= k) { /* too long? */ log_error("Failed to format precise time"); return -EINVAL; |