I have been playing with time stamps and ISO 8601 format strings. I am
trying to parse a string of the type:
2015-09-30T12:13:14.567Z
or
2015-09-30T10:13:14.567+0200
which contain the equivalent time. Generating the strings is no
problem. It is parsing the strings into seconds and fractions of
seconds that is a problem. I need seconds because I need to do math on
the times. The math can cause times to pass midnight, so the
year/month/day part is required.
It is when I parse the times that I have a problem. What I really want
is the seconds in UTC/Zulu. So local time + time zone offset must also
be handled.
I thought I would use strptime() so I can get the time in a 'struct
tm' that I can pass to timegm() to get UTC/Zulu seconds.
Here is question #1:
The following description claims that strptime() can parse the time
zone (e.g., "+0200") via the %z specifier:
http://www.gnu.org/software/libc/manual/html_node/Low_002dLevel-Time-String…
But on all openSUSE versions I have tried (up to and including Leap),
the man page for strptime() does not list %z as a recognized
parameter. Is the man page wrong, or is openSUSE using some other
strptime? The odd thing is that the inverse function strftime() does
list the %z (and %Z) options.
And question #2:
Why doesn't MinGW from OBS contain strptime() when it does contain
strftime()? I see various explanations. And it is probably just that
MinGW is that way. Anyone know of a complete strptime() implementation
that can be added to a library? Picking out the GNU version was less
than obzious. The only other implementations I have seen are very
incomplete (e.g., no support for %z).
--
Roger Oberholtzer
--
To unsubscribe, e-mail: opensuse-programming+unsubscribe(a)opensuse.org
To contact the owner, e-mail: opensuse-programming+owner(a)opensuse.org