jamadagni
9th January 2006, 13:51
I quote from man localtime:
The ctime(), gmtime() and localtime() functions all take an argument of data type time_t which represents calendar time. When interpreted as an absolute time value, it represents the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
Now I get this time_t value using time(NULL), and pass a pointer to that value to localtime() to get the local time as a struct tm. I wonder how localtime finds out the time zone value which is not a part of the time_t value (as far as I can make out from the man page.
Any hints as to this would be appreciated. Otherwise I have to do some circus with finding out the difference between the values returned by localtime and gmtime.
The ctime(), gmtime() and localtime() functions all take an argument of data type time_t which represents calendar time. When interpreted as an absolute time value, it represents the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
Now I get this time_t value using time(NULL), and pass a pointer to that value to localtime() to get the local time as a struct tm. I wonder how localtime finds out the time zone value which is not a part of the time_t value (as far as I can make out from the man page.
Any hints as to this would be appreciated. Otherwise I have to do some circus with finding out the difference between the values returned by localtime and gmtime.