Trevor Harmon
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?