Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29487 Discussions

How to avoid windows daylight saving setting

Gerdes_Gerhard_J
Beginner
1,549 Views

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.

 

 

 

0 Kudos
5 Replies
andrew_4619
Honored Contributor III
1,549 Views

I had this problem a few month back,http://software.intel.com/en-us/forums/topic/369084  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.

0 Kudos
andrew_4619
Honored Contributor III
1,549 Views

[fortran]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)[/fortran]

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.

0 Kudos
Gerdes_Gerhard_J
Beginner
1,549 Views

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.

 

alt text

 

0 Kudos
Gerdes_Gerhard_J
Beginner
1,549 Views

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.

 

 

 

 

0 Kudos
andrew_4619
Honored Contributor III
1,549 Views

@GerdJ

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..

Andrew

 

0 Kudos
Reply