I have seen a lot of examples of converting UTC into local time, but
none for the other way around.
I have written a log file converter that needs to convert between 2
different formats. The first file format has its times specified as
local time, and the second has times specified as UTC.
As yet, I have the date/time as a DATE, a SYSTEMTIME, a time_t and a
struct tm, the contents of all of them are specified in local time.
None of these formats seem to have a field or way of specifiying a time
zone in them.
I thought I could simply use the gmtime(time_t) function to perform the
conversion. But it just gave out the same number as I gave in, so I am
not sure what the point is.
Then I read about the _tzset() function that prepares the time zone
variables for the converter functions. However calling this function
(before calling gmtime) has no effect. It appears from the gmtime
documentation, that this function always assumes the input is in UTC
which seems strange to me, as thats what its output is supposed to be.
So I am looking for a conversion function that converts from local time
to UTC.
Any ideas? Thanks.