Skip to content
time.c 681 B
Newer Older
Raymond Toy's avatar
Raymond Toy committed
/*

 This code was written as part of the CMU Common Lisp project at
 Carnegie Mellon University, and has been placed in the public domain.

*/
wlott's avatar
wlott committed

/* Time support routines that are easier to do in C then in lisp. */

#include <stdio.h>
#include <time.h>
#include "lisp.h"

void
get_timezone(time_t when, int *minwest, boolean * dst)
wlott's avatar
wlott committed
{
    struct tm ltm, gtm;
wlott's avatar
wlott committed

    ltm = *localtime(&when);
    gtm = *gmtime(&when);

    mw = ((gtm.tm_hour * 60) + gtm.tm_min) - ((ltm.tm_hour * 60) + ltm.tm_min);
    if ((gtm.tm_wday + 1) % 7 == ltm.tm_wday)
    else if (gtm.tm_wday == (ltm.tm_wday + 1) % 7)
wlott's avatar
wlott committed
    *dst = ltm.tm_isdst;
}