Commit eecdcb55 authored by Daniel Salzman's avatar Daniel Salzman

time: add UTC time zone to ISO 8601

parent bd06971b
......@@ -389,7 +389,7 @@ int knot_time_print(knot_time_print_t format, knot_time_t time, char *dst, size_
struct tm lt;
time_t tt = (time_t)time;
ret = (localtime_r(&tt, &lt) == NULL ? -1 :
strftime(dst, dst_len, "%Y-%m-%dT%H:%M:%S", &lt));
strftime(dst, dst_len, "%Y-%m-%dT%H:%M:%SZ", &lt));
return (ret > 0 ? 0 : -1);
case TIME_PRINT_RELSEC:
ret = snprintf(dst, dst_len, "%+"KNOT_TIMEDIFF_PRINTF,
......
......@@ -171,7 +171,7 @@ static void test_time_print(void)
ret = knot_time_print(TIME_PRINT_ISO8601, t, buff, bufl);
buff[11] = '0', buff[12] = '0'; // zeroing 'hours' field to avoid locality issues
test_time_print_expect(ret, buff, bufl, "1970-01-01T00:13:20", "iso");
test_time_print_expect(ret, buff, bufl, "1970-01-01T00:13:20Z", "iso");
t2 = knot_time_add(knot_time(), -10000);
ret = knot_time_print(TIME_PRINT_HUMAN_MIXED, t2, buff, bufl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment