Commit f610280a authored by wlott's avatar wlott
Browse files

Deal with the fact that timezones can be -24 thru 24 inclusive. Hence we

have to also look at the difference in the day between local and gm to tell
what the minutes-west is.
parent 8eb42c63
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/time.c,v 1.1 1993/11/12 19:21:23 wlott Exp $ */
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/time.c,v 1.2 1993/11/13 01:08:46 wlott Exp $ */
/* Time support routines that are easier to do in C then in lisp. */
......@@ -9,10 +9,16 @@
void get_timezone(time_t when, int *minwest, boolean *dst)
{
struct tm ltm, gtm;
int mw;
ltm = *localtime(&when);
gtm = *gmtime(&when);
*minwest = ((gtm.tm_hour*60)+gtm.tm_sec) - ((ltm.tm_hour*60)+ltm.tm_sec);
mw = ((gtm.tm_hour*60)+gtm.tm_min) - ((ltm.tm_hour*60)+ltm.tm_min);
if ((gtm.tm_wday + 1) % 7 == ltm.tm_wday)
mw -= 24*60;
else if (gtm.tm_wday == (ltm.tm_wday + 1) % 7)
mw += 24*60;
*minwest = mw;
*dst = ltm.tm_isdst;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment