- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ignoring the Year 2000 issues with gmtime, it states in the Intel Fortran Libraries reference that gmtime returns this:
tarray(1) Seconds (0-59)
So, does it not handle leap seconds?
Thanks,
Chris
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How would it know to add a leap second?
The ANSI C definition of gmtime agrees with the Intel documentation.
The ANSI C definition of gmtime agrees with the Intel documentation.
Message Edited by sblionel on 06-07-2005 11:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My reading of the ANSI C standard shows this:
The range and precision of times representable in
clock_t and time_t areimplementation-defined. The
tm structure shall contain at least the following members,in any order. The semantics of the members and their normal ranges are expressed in the
comments.
268)int tm_sec; //
seconds after the minute [0, 60]int tm_min; //
minutes after the hour [0, 59]int tm_hour; //
hours since midnight [0, 23]int tm_mday; //
day of the month [1, 31]int tm_mon; //
months since January [0, 11]int tm_year; //
years since 1900int tm_wday; //
days since Sunday [0, 6]int tm_yday; //
days since January 1 [0, 365]int tm_isdst; //
Daylight Saving Time flag268) The range [0, 60] for
tm_sec allows for a positive leap second.This seems to be consistent with what is in time.h,.
Message Edited by cjosefy on 06-07-2005 10:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The references I have show 0-59, but I'm unclear as to how the routine would know there's a leap-second. In any event, whatever the C gmtime returns, the Fortran one would too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well the declaration of gmtime in time.h say [0-60] on my RHEL 3 machine. However, I don't know how the routine would now that there is a leap second. I just wanted to know if it was possible to return a 60 to the FORTRAN routine. My reference from above is
ISO/IEC 9899:TC2
Committee Draft May 6, 2005 WG14/N1124The ANSI C Programming Language by Kernighan and Ritchie says it can be [0,61]
Message Edited by cjosefy on 06-09-2005 01:50 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know how gmtime would know to return a 60 there. I assumed it just divided the system clock by fixed values to come up with the proper elements.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From my reading, it seems that the time functions get the time from the time zone files on the system. POSIX standards say to ignore leap seconds, and that it the default behavior on Linux. However, there are time zone files with the leap seconds in them, and if your system uses those, then your functions still work but are not POSIX compliant. For example, on my system the time zone files /usr/share/zoneinfo/GMT doesn't have leap seconds, but /usr/share/zoneinfo/right/GMT does.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suggest you pose this as a query to Intel Premier Support and see what answer you get. I'm pretty sure that the Fortran gmtime is just a wrapper around the C gmtime.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll do that. In my experience FORTRAN gmtime gives years that are 100 off from the correct year. However, C gmtime gives the correct year.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page