Boost logo

Boost Users :

Subject: Re: [Boost-users] handling of daylight saving time...
From: Archie14 (admin_at_[hidden])
Date: 2010-04-30 16:34:44


Trevor Harmon <Trevor.W.Harmon <at> nasa.gov> writes:

>
> On Apr 30, 2010, at 8:22 AM, Archie14 wrote:
>
> > My software records time events on the computer and it does it using
> > whatever
> > timezone and daylight saving time settings are on this computer.
>
> Why not record them in UTC? Seems like that would eliminate the
> problem. You could always adjust to the current timezone and DST
> settings when it's time to display them.
>
> Trevor
>

I made a mistake, that's why. Now I have about a year worth of data and the
recorder runs uninterrupted for the last half a year:) I have to rewrite the
data to a new UTC format, but I don't know if it is possible to get rid of
this gap using datetime library facilities. I am thinking of something like
this:

// this variable is either adjusted or not for the daylight saving time
// due to the mistake in the recorder.
boost::posix_time::local_date_time my_poorly_recorded_timestamp;

//retrieve stored timestamp and assign it to my_poorly_recorded_timestamp
...

// i know my timezone - here is the definition
std::string gmt = (boost::format("TMZ%1%
TMS1:00:00,M3.2.0/02:00:00,M11.1.0/02:00:00") % gmtoffset).str();

boost::local_time::time_zone_ptr timezone(new
boost::local_time::posix_time_zone (gmt));

// now, having the timezone - how can I
// get UTC or unadjusted time back from my_poorly_recorded_timestamp?


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