
On Tue, 11 Jan 2005 07:26:20 -0600, Bill Lear
I'd like to determine the total number of seconds between a date and the epoch ('00:00:00 1970-01-01 UTC'), The date can be in a timezone that has daylight savings. The date should be converted to UTC, with appropriate daylight savings adjustments made, and then the epoch subtracted from it. This should mirror the unix GNU 'date' utility, which can be run as:
% TZ="America/New_York" date --date='2004-10-04 12:14:32' +%s 1096906472
I've looked at the doc, but it's not clear how to do this. Could someone give me a few pointers, please?
I would make use of the standard library facilities timelocal or timegm to convert a struct tm to time_t format. The former assumes the time is expressed in local time (as specified by the TZ environment variable or via tzset) and the latter assumes it is in GMT. The support for timezone conversions in Boost.DateTime is rudimentary at best and does not currently make use of operating system facilities like the zoneinfo database. -- Caleb Epstein caleb dot epstein at gmail dot com