SUMMARY: mktime() question

From: Shiva Gowda (sgowda@orga.com)
Date: Wed Jul 24 2002 - 11:54:52 EDT


Thanks to Paul A. Sand, Bob Vickers, Oisin McGuinness

Bob wrote:
"mktime is supposed to give different results in different time zones. It
converts local time to an internal Unix value which is always in UTC."

Since both the system timzones are different I may get different values.
But MET DST & CEST are UTC+02 I was expecting the same value.

Oisin wrote:
"..Your code fills in all of them, except for the tm_isdst field; presumably
different initializations are being used on the two OS'es;

..You could check what the value appears to be before mktime is called to
verify that there are differences in the initialization of tm_isdst."

That's write, tm_isdst is being set to some +ve value in 4.0f and 0 in 5.1A.

thx,

Shiva

-------- Original Message --------
Hi Gurus,

Recently we migrated one of our application from 4.0F to 5.1A.
  From then onwards we have some problems with the application.
That is because of mktime() library function. The values returned
by this function is not the same. Is there any change in the
functionality of mktime()?

The timezones are different on both the systems. One is in DST &
the other in CEST. Both are UTC+02. Does it affect the mktime() function?

thx,

//Shiva

Here is an example:

sgowda@od-dec-unix-7<113> cat time.c
#include <stdio.h>
#include <time.h>

main() {
          struct tm t;
          sscanf("19990716112330", "%04d%02d%02d%02d%02d%02d",
                  &(t.tm_year), &(t.tm_mon), &(t.tm_mday), &(t.tm_hour), &(t.tm_min), &(t.tm_sec));
          t.tm_year -= 1900;
          t.tm_mon--;
          printf("time in time_t: %d\n", mktime(&t));
}

sgowda@od-dec-unix-7<107> sizer -v
Digital UNIX V4.0F (Rev. 1229); Sun Jan 13 16:29:23 MET 2002
sgowda@od-dec-unix-7<108> ./time
time in time_t: 932120610 #<<<<<< Note the value
sgowda@od-dec-unix-7<109>

sgowda@ds10l-51A<83> sizer -v
Compaq Tru64 UNIX V5.1A (Rev. 1885); Tue Feb 5 13:03:20 CET 2002
sgowda@ds10l-51A<84> ~/time
time in time_t: 932117010 #<<<<< Its different from above output.
sgowda@ds10l-51A<85>



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:48:47 EDT