Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-10-25 20:40:27


Jacob L. Anawalt wrote:
> Hi,
>
> I've started experimenting with Boost.Date_Time's Local Time stuff.
> While using a posix_time_zone object the results were not what I
> expected. I used the POSIX.1 (IEEE Std 1003.1) timezone string suitable
> for use in the TZ environment variable describing my timezone for the
> year 2006:
>
> MST7MDT,M4.1.0,M10.5.0
>
> Date_Time's posix_time_zone object told me that it was already the 26th
> but my wall clock disagrees. :)
>
> The online documentation says "A posix_time_zone is unique in that the
> object is created from a Posix time zone string (IEEE Std 1003.1)." and
> "'offset' is the offset from UTC."
>
> In the sources I've come across the offset part of a POSIX.1 timezone
> string is defined as "the value added to the local time to arrive at
> Coordinated Universal Time" with a not that "[i]f 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 '+' )."
>
> * http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap08.html
> * man pages of tzset
>
> Why do I need a negative (-) offset to make posix_time_zone work when
> the time zone is west of the Prime Meridian?

Well, this is really just convention at some level. You might find this
reference helpful:

http://aa.usno.navy.mil/faq/docs/world_tzones.html

It shows the offsets for various regions of the world.

> I couldn't find anyone else raising this issue on the list or bug
> tracker, so maybe I'm just up in the night.

I'm not aware of any bugs in this code...

> Thank-you for the library. I really like some of the concepts in
> Date_Time Posix Time and Gregorian and have high hopes for Local Time stuff.

My pleasure :-)

Jeff


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net