[Info-vax] EU will abandon daylight savings time in 2021
Jan-Erik Söderholm
jan-erik.soderholm at telia.com
Fri Apr 5 09:56:58 EDT 2019
Den 2019-04-05 kl. 15:43, skrev Arne Vajhøj:
> On 4/5/2019 9:31 AM, Jan-Erik Söderholm wrote:
>> Den 2019-04-05 kl. 15:26, skrev Arne Vajhøj:
>>> On 4/5/2019 9:22 AM, Arne Vajhøj wrote:
>>>> On 4/5/2019 6:48 AM, Arne Vajhøj wrote:
>>>>> On 4/5/2019 4:27 AM, Jan-Erik Söderholm wrote:
>>>>>> Den 2019-04-05 kl. 02:02, skrev Arne Vajhøj:
>>>>>>> On 4/4/2019 6:08 AM, Jan-Erik Söderholm wrote:
>>>>>>>> Den 2019-04-04 kl. 03:27, skrev Arne Vajhøj:
>>>>>>>>> On 4/3/2019 1:37 PM, Jan-Erik Söderholm wrote:
>>>>>>>>>> We have some local timestamps that has to be
>>>>>>>>>> converted to GMT/UTC before sent to another system, and these are
>>>>>>>>>> both
>>>>>>>>>> from "winter time" and "summer time". We can of course hardcode the
>>>>>>>>>> dates for the switches and compare, but it would be nice if the rule
>>>>>>>>>> could be used...
>>>>>>>>>
>>>>>>>>> What do you have and what do you need to convert it to?
>>>>>>>>
>>>>>>>> An INTEGER "date" with format YYYYMMDD, ag 20190404 for today.
>>>>>>>>
>>>>>>>> A SMALLINT "time" with format HMM or HHMM, range from 1 (one minute
>>>>>>>> after midnight) to 2359 (one minute before midnight). I guess
>>>>>>>> it could be zero also for the first minute after midnight, but
>>>>>>>> the system is having it's night-batch windows then.
>>>>>>>>
>>>>>>>> These two are in Swedish local time (winter or summer time).
>>>>>>>>
>>>>>>>> The target system uses Unix Epoch format (seconds since some date).
>>>>>>>
>>>>>>> I am not a Python expert, but it looks like:
>>>>>>>
>>>>>>> from datetime import date
>>>>>>> import time
>>>>>>>
>>>>>>> v = 20190404
>>>>>>> d = date(v / 10000, (v / 100) % 100, v % 100)
>>>>>>> t = time.mktime(d.timetuple())
>>>>>>>
>>>>>>> works for the first conversion.
>>>>>>
>>>>>> No poblem, we have that part since some time. But to a
>>>>>> epoch time in local time, not to GMT/UTC.
>>>>>
>>>>> That code snippet returns UTC here.
>>>>>
>>>>> But I admit that I did not test on VMS. I can try that.
>>>>
>>>> I tried on VMS.
>>>>
>>>> It looks like it does UTC but does not handle DST.
>>>>
>>>> Either the old Python 2.7.2 has a DST bug or I messed
>>>> up the TZ DST setting.
>>>
>>> It was my TZ DST setup that was wrong.
>>>
>>> It works now.
>>>
>>> UTC.
>>
>> OK. If you like, you could either post your Python test code
>> or, again if you like, mail it to me.
>
> The code is above.
>
> To test it I just did a print of t and compared to a timestamp
> from a C program.
>
> Arne
>
>
Ah, OK...
We have the time-of-day part also, a smallint from 0000 - 2359.
Anyway, we'll look at it.
More information about the Info-vax
mailing list