How to avoid windows daylight saving setting

How to avoid windows daylight saving setting

The fortran routines to pack and unpack time and date values with PACKTIMEQQ and UNPACKTIMEQQ are dependend on the daylight setting of the Windows operating system. Is there a fortran procedure to avoid this setting, meaning that it allways transfers time data only into/from standard time without daylight change (only winter time)?

Routines like PXFLOCALTIME indicate the daylight savings setting by a flag, but it has no correponding routine to pack time and date into a unix timestamp.




6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I had this problem a few month back,  is the thread on the subject. I wrote my own date packer and unpacker in the end to emulate the system ones but always assuming the same time offset. I can check is they are easy to share.

logical(4) function is_leap_year(iyear)
subroutine unpacktimecc(ipack,iyr,imon,iday,ihr,imin,isec)
subroutine packtimecc(ipack,iyr,imon,iday,ihr,imin,isec)

It was but three routines in a module that take/give values based on seconds since 00:00 of 1 Jan 1970 assuming no time zone offsets or daylight saving. I could post them if it is off use.

I found out, that my programme works proper if I deaktivate the "automatically adjust clock for the daylight saving time" parameter (Systemcontrol, Date and Time,  Time Zone Settings). But it means, that my programme does not work reliable, it produces wrong results if it runs on a computer where this parameter is not deactivated.

If you have an own routine for the time packing I would be grateful, if you could give it to me.



I found out, that the result of time packing or unpaking depends on the TimeZoneSetting parameters in windows. If the paramter "automatically adjust clock for daylight saving"  (System control / date and Time / Time Zone Settings) is deactivated, the results will be correct. But it means my programme will not work reliable on different computers, because the results depend on the individual windows parameter setting.

I would be grateful, if you could help with an own tool.

Sorry for the late reply, but it seems my previous answer was not submitted or accepted correctly.






I attached  a module with the routines I use, I don't claim that they are the most efficient way but then I am not calling them a zillion times. You are welcome to use/modify as you wish..




Downloadapplication/octet-stream timecc.f903.59 KB

Leave a Comment

Please sign in to add a comment. Not a member? Join today