I thought that originally, but COleDateTime MUST be taking account of DST as the GetHour() function returns the correct value. Thinking about it overnight, I'm beginning to think that I should have applied DST when generating epoch - that would fit the symptoms, wouldn't it ?
(The Arduino works with an unsigned quantity, so it will not be a problem !)
I now believe that the problem is due to taking the DIFFERENCE between Current Time and epoch (I actually got this code off the internet, but didn't do much thinking about it !!!) If DST is applied inherently to all OleDateTime objects, then taking the difference effectively removes any adjustment due to DST, So that would account for it for GetTime() and GetTotalSeconds() being 3600 seconds different !!
ColeDateTime stores a time stamp value without information about time zone and DST. It is up to you to know if the value is local time or UTC. If you use COleDateTime::GetCurrentTime to initialise it, it will hold a local time value. If you use the constructor or assignment operator accepting a time_t or _time64_t value, it will be UTC when the time_t value has been retrieved using time() and not adjusted afterwards.
If you need to store time stamp values for later use, store them as UTC. This avoids wrong values and simplifies calculation of time spans. If you need to display times as local times, perform the conversion just before display.
Hello Jochen, I was not aware that the timestamp obtained from COleDateTime would depend on how the object was initialised. Therefore in my test code the object epoch would result in a UTC value, whereas that obtained from the other object (which initialised via GetCurrentTime()) would be localtime. This then blows my "difference" explanation as to why the result from CTime is 3600 seconds different from the COleDateTimeSpan object. My Arduino code expects time quantities to be received as localtime (i.e. adjusted for DST)
Adam works in the in networking security cell. He wants to generate secret keys
following a pattern. The pattern consists of the characters X and Y.
where X means increasing and Y means decreasing. Help him devise an
algorithm to generate the secret key which is the minimum number encoded
following that pattern. Digits from 1-9 and digits can’t repeat.
Sample Input: Sample Output: