We all know the mktime() function, which converts a
*local* time in (struct tm) format into seconds since the epoch
GMT.
But is there an equivalent function which converts
a *GMT* time in (struct tm) format into seconds since the epoch
GMT?
On windoze, I found an undocumented function hiding
in library source called _mkgmtime() which does this
perfectly.
But I don't want to lose portability. Is there a
similar function in Linux-land?
I ask because I've been hitting all kinds of snags
with handling the 'yyyymmddhhmmss'-format times in FCP.
Many or most DBRs use Jan 1, 2000, 00:00:00 as the
baseline.
The 'fun' happens in the Southern Hemisphere, where
at that time, localtime is one hour ahead with Daylight Saving.
That plays havoc with the date
calculation.
I tried setting TZ to zero, then doing a tzset().
But then time() becomes inaccurate, because it takes the system clock to be
GMT!
I'd rather not have to reinvent the wheel by
writing yet another "compute the number of days between two dates" function,
plus the pain of timezones, and determining whether it's daylight saving now,
and was it daylight saving in the place and time of the DBR baseline....
AAARRRGGHHHH!
Cheers
David
|
- Re: [freenet-chat] Quick C Question David McNab
- Re: [freenet-chat] Quick C Question Mark J. Roberts
- Re: [freenet-chat] Quick C Question David McNab