16 Aug
2006
16 Aug
'06
07:58
Per Jessen wrote:
The question is - mktime() looks at the local timezone settings ... which I'd rather it didn't. OK, I could fiddle with the TZ variable and make it UTC, but as I'm multi-threaded this could have undesired effects elsewhere.
I should explain what I'm really doing here: I sscanf() the timestamp into a 'tm' struct, and I correct the year and month such that they comply with what 'tm' expects. Then I convert to a number of seconds since the epoch using mktime() and subtracting the number of seconds as specified in the offset part of the timestamp - e.g. +0200 becomes -7200 seconds. But my number of seconds always ends up being off by 3600 seconds, i.e. 3600 seconds less than it should be. /Per Jessen, Zürich