Skip to content
Snippets Groups Projects
Commit 05077226 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix timezone portion of string output of time_to_isoDateTimeStr()

The output of this function was not ISO-8601 complaint (blush) and was not
parsable by isoDateTimeStr_parse() (returned -1).

e.g. "20231217T011437-480" rather than "20231217T135222-0800" (in PST)

Positive UTC offset (eastern) zones would be even worse (the + separator
would be missing).
parent 0c991f98
Branches
Tags
No related merge requests found
......@@ -375,8 +375,10 @@ char* xpDateTime_to_isoDateTimeStr(xpDateTime_t dt
char* time_to_isoDateTimeStr(time_t t, xpTimeZone_t zone, char* str, size_t maxlen)
{
snprintf(str, maxlen, "%" PRIu32 "T%06" PRIu32 "%d"
,time_to_isoDate(t), time_to_isoTime(t), zone);
char zstr[16];
snprintf(str, maxlen, "%" PRIu32 "T%06" PRIu32 "%s"
,time_to_isoDate(t), time_to_isoTime(t)
,xpTimeZone_to_isoTimeZoneStr(zone, "", zstr, sizeof zstr));
return str;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment