Hi Paul, Thank you so much for replying my mail. What if a time zone is specified together with the date/time value? For instance, is there any function that call whether "2007-11-04 01:30 PST" is DST? My current project needs to do conversions between local time and UTC. For date/time between 1970 and 2038, converting local time (in struct tm) to UTC can be done by calling mktime() and then gmtime(). But converting UTC to local time is not that straight forward. In addition, for date/time falling outside of (1970, 2038), we have no way to determine whether the given data/time value is DST or not and thus cannot do conversion correctly. That's why I was asking the original question. Any ideas would be sincerely appreciated. Zhenqiang Fan -----Original Message----- From: Paul Eggert [mailto:eggert@CS.UCLA.EDU] Sent: Tuesday, April 03, 2007 4:30 PM To: Fan, Zhenqiang Cc: tz@elsie.nci.nih.gov Subject: Re: FW: Questions
From: Fan_Zhenqiang@emc.com [mailto:Fan_Zhenqiang@emc.com] Sent: Tuesday, April 03, 2007 3:21 PM
Is there a function (in any of these source files) that takes a date/time value and tells whether the date/time is daylight saving time?
If T is a time_t value, and if localtime(&T) returns non-null, then localtime(&T)->tm_isdst should tell you what you want to know (about T). If the date/time value is some string like "2007-11-04 01:30" then you're out of luck, because that time stamp is ambiguous in most of North America: it might be DST, and it might be standard time.