Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!mips!zaphod.mps.ohio-state.edu!rpi!uupsi!rice!sun-spots-request From: deltam!mark@uunet.uu.net Newsgroups: comp.sys.sun Subject: Timezones anyone? Keywords: Miscellaneous Message-ID: <6494@brazos.Rice.edu> Date: 7 Apr 90 07:49:14 GMT Sender: news@rice.edu Organization: Sun-Spots Lines: 44 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 9, Issue 116, message 4 I have need of code that takes a partially filled in time structure, and from the information listed below, determines if that time falls within a period that is in daylight savings time. The time structure looks like this: struct tm { int tm_sec = 0; int tm_min = 0; int tm_hour = 23; int tm_mday = 1; int tm_mon = 0; int tm_year = 90; int tm_wday; /* Doesn't matter */ int tm_yday; /* ditto */ int tm_isdst; /* This is what I want to fill in */ char *tm_zone; /* set from a prior call to localtime() */ long tm_gmtoff; /* set by same call to localtime() */ } I have a function that will take a time structure and return the long integer representation of that time structure (the reverse of localtime()), but it requires the tm_isdst to be set. I need a way of determining from the month, day, year, hour, and minute whether it is or is not daylight savings time. As a kludge work-around I am calculating the long with whatever the flag is set to at the current time. This at least gets me in the ballpark. I then take that long int and run it back through localtime() to determine the proper setting of tm_isdst, which is then set into the first time structure and the long int calculation is repeated. UUUUUGGGGLLLYYYY! And it breaks anytime the target time happens to be in the hour lost or gained at the exact time the changeover to/from daylight savings time is made. I don't like it, but it's the best I can do from what I have been able to find. I am sorry about the length of this posting, but I want to give my potential assistants all the information they need. Can anyone help me????? Mark Galbraith Voice: +1 415 449 6881 Programmer/Analyst UUCP: uunet!deltam!mark System Administrator/Postmaster Domain: mark@deltam.com Delta Microsystems, Inc. Compuserve: 76234,3126