Jacob Anawalt wrote:
Jeff Garland wrote:
Well, this is really just convention at some level.
Right. POSIX.1 (IEEE Std 1003.1) convention as far as I am able to find.
Sorry for the delayed response...travel and such. Well, I spoke a bit to losely, it isn't just convention it's in the spec.
Unless I've found the wrong POSIX.1 documentation I consider the fact that posix_time_zone expects negative values for offsets west of the Prime Meridian or the fact that it claims to use IEEE Std 1003.1 timezone strings to be a bug.
Anyway, if you go to http://www.unix.org/version3/ieee_std.html and register you can read the official spec. Here's the excerpt of the key parts: TZ This variable shall represent timezone information.... The expanded format (for all TZ s whose value does not have a colon as the first character) is as follows: stdoffset[dst[offset][,start[/time],end[/time]]] ... offset Indicates the value added to the local time to arrive at Coordinated Universal Time. The offset has the form: hh[:mm[:ss]] The minutes ( mm) and seconds ( ss) are optional. The hour ( hh) shall be required and may be a single digit. The offset following std shall be required .... If preceded by a '-', the timezone shall be east of the Prime Meridian; otherwise, it shall be west (which may be indicated by an optional preceding '+' ).
It would be nice to be able to use the TZ environment variable as the argument to the posix_time_zone constructor if TZ existed and did not l have a leading colon.
So, after staring at this spec for awhile, it looks to me that this is a major
bug in posix timezone :-( For whatever reason, posix has the utc offset
definitions inverted from the way it actually is...so you always have to
invert the sign of the offset to get the actual utc offset.
To be 100% sure, I'll need a bit more info. What OS are you using, what
timezone are you in, and what is TZ set to? Assuming it's unix, what do
'date' and 'date -u' give you?
And then what I assume you are doing exactly in date-time. Based on the first
email you sent I imagine it's something like:
shared_ptr