handling of daylight saving time...

My software records time events on the computer and it does it using whatever timezone and daylight saving time settings are on this computer. I realized too late that, while storing timestamps, I am not accounting for this daylight adjustment process. So, if hypothetically speaking, the daylight adjustment happens today at 9:00 am and I am writing my timestamps every second I will have something like that: … 8.58 8.59 9.00 10.01 (without timesaving should be 9.01) 10.02 (without timesaving should be 9.02) … When I am reading my timestamps back I am constructing timezone and using it for timestamps manipulation std::string gmt = (boost::format("TMZ%1% TMS1:00:00,M3.2.0/02:00:00,M11.1.0/02:00:00") % gmtoffset).str(); , but this one-hour gap persists, as I now think it should. The question is: is it possible to do manipulation with datetime library to remove this gap without hard-coding one hour removal after specific date/time of daylight saving time?

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

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?

If you are rewriting a known amount of files, one time, to match your updated code, then you can use a script or simple program just smart enough to get that right. It needs to know the time-change points that occurred during the half year in question. Was it a spring-forward or fall-back? The former is no problem. The latter will give a duplicate hour. If data was recorded during both hours, you can figure out where it went backwards by noting the time moving backwards between successive data points. If no data was recorded during either hour, no problem. If data was recorded during one of those hours only, or funny conditions like the first half of the first hour and the second half of the second hour, then you are sunk as you cannot determine which hour bearing the same number it was.
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:
TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

I use code based on the Olson database to figure out concomitant civil times. I don't think Boost has a module that includes this full database (that is, knowledge of how the time is changed when the rule was different in different years).
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Archie14 Sent: Friday, April 30, 2010 10:22 AM To: boost-users@lists.boost.org Subject: [Boost-users] handling of daylight saving time...
My software records time events on the computer and it does it using whatever timezone and daylight saving time settings are on this computer. I realized too late that, while storing timestamps, I am not accounting for this daylight adjustment process. So, if hypothetically speaking, the daylight adjustment happens today at 9:00 am and I am writing my timestamps every second I will have something like that: … 8.58 8.59 9.00 10.01 (without timesaving should be 9.01) 10.02 (without timesaving should be 9.02) … When I am reading my timestamps back I am constructing timezone and using it for timestamps manipulation std::string gmt = (boost::format("TMZ%1% TMS1:00:00,M3.2.0/02:00:00,M11.1.0/02:00:00") % gmtoffset).str(); , but this one-hour gap persists, as I now think it should.
The question is: is it possible to do manipulation with datetime library to remove this gap without hard-coding one hour removal after specific date/time of daylight saving time?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
participants (3)
-
Archie14
-
John Dlugosz
-
Trevor Harmon