Boost logo

Boost Users :

Subject: Re: [Boost-users] Local_date_time constructor question
From: Mika Heiskanen (mika.heiskanen_at_[hidden])
Date: 2011-01-05 14:12:48


On Wed, 2011-01-05 at 19:10 +0200, qplace wrote:
> time_zone support in datetime library covers usage of DST extensively. Every
> timezone in datetime library can be defined with or without usage of DST.
> Since time_zone is one of the parameters to the constructor it carries DST
> information by definition. The actual reason for me to ask my question here
> was the exception caused by the conflict between this forth parameter and the
> DST settings that I was using in my timezone. Since then I moved to a another
> constructor, but the question remains - why do we have to supply the forth
> parameter when the timezone parameter defines usage of DST.

The constructor documentation states:

  The passed time information understood to be in the passed tz. The DST
  flag is calculated according to the specified rule. May throw a
  ambiguous_result or time_label_invalid exception.

By applying DST rules you may get the same local time twice in a year,
hence you need to specify whether DST was active or not to fully
determine the respective UTC time.

Avoid the mentioned constructor unless you have all the necessary
information at hand.

--> Mika Heiskanen


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