Title: | DIGITAL UNIX (FORMERLY KNOWN AS DEC OSF/1) |
Notice: | Welcome to the Digital UNIX Conference |
Moderator: | SMURF::DENHAM |
Created: | Thu Mar 16 1995 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 10068 |
Total number of notes: | 35879 |
Melbourne University have a problem with their PMDF application which Innosoft have tracked down to be a problem with establishing the epoch. I am able to repeat the problem on my machine running 4.0A. A summary of the problem is: A. Epoch is 00:00:00 Jan 1 1970 GMT or GMT + 10 AEST (Australian Eastern Standard Time) B. Calling the re-entrant version of ctime with 0 seconds confirms the above epoch adjusted for the local time zone. C. Calling mktime with the current local time set (to 10) with no daylight savings returns a correct value of 0 secs. With the daylight savings set to 1 a value of -3600 is returned; ie 1 hour before the epoch. Is this because 4.0A assumes that there is a 11 hour difference when daylight savings is in effect; ie GMT + 10 + 1. Thus for 10 hours past the epoch this would equate to the epoch - 1hour (-3600) + 11. Does anyone know if this behaviour is consistent in previous versions of DU; ie 3.x? ===== Richard. Here is the problem that PMDF is complaining about (again running on DUNIX 4.0A, and from memory 4.0B). Dunix does not seem to know what the epoch is even though you can test it with a 0 buffer. Sample code supplied by Innosoft. The tm_isdst variable is important. You can get the program to return the correct value for the epoch by setting the tm_isdst variable to 0, but not -1 or +1. We are not on daylight saving currently. I believe this manifests itself by the mail program not being able to process the queues because the "time" has not arrived to process the mail queue. You may want to check this behaviour out yourself. I have run the code on a sun and the behaviour is quite different on Solaris. ==== Richard Quan Tech Support - CSF Melbourne [Posted by WWW Notes gateway]
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
9360.1 | Offending Code Fragment | NETRIX::"[email protected]" | Richard Quan | Thu Apr 10 1997 00:24 | 51 |
void main (void) { time_t time_value, time_get; struct tm time_struct; char buf[30]; memset (buf, 0, 30); time_value = 0; ctime_r (&time_value, buf, 30); printf ("ctime_r get \"%s\"\n", buf); time_struct.tm_year = 1970 - 1900; time_struct.tm_mon = 1 - 1; time_struct.tm_mday = 1; time_struct.tm_hour = 10; time_struct.tm_min = 0; time_struct.tm_sec = 0; time_struct.tm_isdst = 1; printf ("time_strct.tm_year = %d\n", time_struct.tm_year); printf ("time_strct.tm_mon = %d\n", time_struct.tm_mon); printf ("time_strct.tm_mday = %d\n", time_struct.tm_mday); printf ("time_strct.tm_hour = %d\n", time_struct.tm_hour); printf ("time_strct.tm_min = %d\n", time_struct.tm_min); printf ("time_strct.tm_sec = %d\n", time_struct.tm_sec); printf ("time_strct.tm_isdst = %d\n", time_struct.tm_isdst); time_get = mktime (&time_struct); printf ("mktime return %d\n", time_get); } >--------------------------------------------------------------------------- ---- ># cc time.c ># ./a.out >ctime_r get "Thu Jan 1 10:00:00 1970 >" >time_strct.tm_year = 70 >time_strct.tm_mon = 0 >time_strct.tm_mday = 1 >time_strct.tm_hour = 10 >time_strct.tm_min = 0 >time_strct.tm_sec = 0 >time_strct.tm_isdst = 1 >mktime return -3600 > > [Posted by WWW Notes gateway] |