basic/time-util: add function to format timestamps with different styles

Instead of a multiple fixed format helper functions, add an enum and
a single helper, so that it's easier to extend in the future.
This commit is contained in:
Luca Boccassi
2020-08-19 15:30:13 +01:00
parent caf6bd166f
commit 7b3eb5c97e
10 changed files with 87 additions and 48 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ static int clock_state_update(
if (tx.status & STA_NANO)
tx.time.tv_usec /= 1000;
t = timeval_load(&tx.time);
ts = format_timestamp_us_utc(buf, sizeof(buf), t);
ts = format_timestamp_style(buf, sizeof(buf), t, TIMESTAMP_US_UTC);
if (!ts)
strcpy(buf, "unrepresentable");
log_info("adjtime state %d status %x time %s", sp->adjtime_state, tx.status, ts);