summaryrefslogtreecommitdiff
path: root/src/test/test-date.c
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2020-06-19 11:24:09 +0100
committerLuca Boccassi <luca.boccassi@microsoft.com>2020-08-19 15:30:13 +0100
commit7b3eb5c97ec835100b2974dae035004d07b6d60c (patch)
tree7c0330b87f962131cf05f934540092af73f74a34 /src/test/test-date.c
parentcaf6bd166f6521e1e33a25c39bb2e1b05d61b733 (diff)
downloadsystemd-7b3eb5c97ec835100b2974dae035004d07b6d60c.tar.gz
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.
Diffstat (limited to 'src/test/test-date.c')
-rw-r--r--src/test/test-date.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/test-date.c b/src/test/test-date.c
index 7d27cfa703..f39eca6176 100644
--- a/src/test/test-date.c
+++ b/src/test/test-date.c
@@ -11,7 +11,7 @@ static void test_should_pass(const char *p) {
log_info("Test: %s", p);
assert_se(parse_timestamp(p, &t) >= 0);
- assert_se(format_timestamp_us(buf, sizeof(buf), t));
+ assert_se(format_timestamp_style(buf, sizeof(buf), t, TIMESTAMP_US));
log_info("\"%s\" → \"%s\"", p, buf);
assert_se(parse_timestamp(buf, &q) >= 0);
@@ -19,7 +19,7 @@ static void test_should_pass(const char *p) {
char tmp[FORMAT_TIMESTAMP_MAX];
log_error("round-trip failed: \"%s\" → \"%s\"",
- buf, format_timestamp_us(tmp, sizeof(tmp), q));
+ buf, format_timestamp_style(tmp, sizeof(tmp), q, TIMESTAMP_US));
}
assert_se(q == t);