Newsgroups: comp.std.c Path: utzoo!telly!druid!darcy From: darcy@druid.uucp (D'Arcy J.M. Cain) Subject: Questions about mktime() Message-ID: <1991Jan18.225155.7310@druid.uucp> >from: darcy@druid.uucp (D'Arcy J.M. Cain) Organization: D'Arcy Cain Consulting, West Hill, Ontario Date: Fri, 18 Jan 91 22:51:55 GMT I am trying to write an ANSI compatible mktime() and I have a few questions. I am using the tm_year, tm_mon tm_mday, tm_hour, tm_min and tm_sec members of the tm structure to calculate the number of seconds. If the information in the other members happens to conflict with the result must I return an error or can I safely ignore the others? According to K&R2 the argument to mktime is not a const. Does this mean that I can modify the structure? It seems to me that it would be convenient to reset it with localtime() to set the other members to sane values. Is there a simple way to adjust for the time zone? I considered t += timezone; but that doesn't handle daylight saving time. I then considered t += tp->tm_isdst ? altzone : timezone; but I can't rely on the tm_isdst being correct, or can I? My feeling is that the user can throw in whatever date and time and mktime() should be able to figure out time zones. Any help appreciated. -- D'Arcy J.M. Cain (darcy@druid) | D'Arcy Cain Consulting | There's no government West Hill, Ontario, Canada | like no government! +1 416 281 6094 |