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
@@ -1335,7 +1335,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
if (d->type == TABLE_TIMESTAMP)
ret = format_timestamp(p, FORMAT_TIMESTAMP_MAX, d->timestamp);
else if (d->type == TABLE_TIMESTAMP_UTC)
ret = format_timestamp_utc(p, FORMAT_TIMESTAMP_MAX, d->timestamp);
ret = format_timestamp_style(p, FORMAT_TIMESTAMP_MAX, d->timestamp, TIMESTAMP_UTC);
else
ret = format_timestamp_relative(p, FORMAT_TIMESTAMP_MAX, d->timestamp);
if (!ret)