need these too
[sbcl/lichteblau.git] / src / runtime / time.c
blobc6403997c5aefbdfe8649c93e43cd43f854dad51
1 /*
2 * time support routines that are easier to do in C than in Lisp
3 */
5 /*
6 * This software is part of the SBCL system. See the README file for
7 * more information.
9 * This software is derived from the CMU CL system, which was
10 * written at Carnegie Mellon University and released into the
11 * public domain. The software is in the public domain and is
12 * provided with absolutely no warranty. See the COPYING and CREDITS
13 * files for more information.
16 #include <stdio.h>
17 #include <time.h>
18 #include "runtime.h"
20 void get_timezone(time_t when, int *minwest, boolean *dst)
22 struct tm ltm, gtm;
23 int mw;
25 ltm = *localtime(&when);
26 gtm = *gmtime(&when);
28 mw = ((gtm.tm_hour*60)+gtm.tm_min) - ((ltm.tm_hour*60)+ltm.tm_min);
29 if ((gtm.tm_wday + 1) % 7 == ltm.tm_wday)
30 mw -= 24*60;
31 else if (gtm.tm_wday == (ltm.tm_wday + 1) % 7)
32 mw += 24*60;
33 *minwest = mw;
34 *dst = ltm.tm_isdst;