From 7b3eb5c97ec835100b2974dae035004d07b6d60c Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Fri, 19 Jun 2020 11:24:09 +0100 Subject: 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. --- src/test/test-date.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/test/test-date.c') 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); -- cgit v1.2.1