X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Fdtime.c;h=5d5375d4c4814599b15a4891d3b9802535400e06;hb=9827ca52b9f69d29f3bc3c74a8ca95e14ee226ff;hp=57b61c8824f8573177bd6c32682c94c55154bc8c;hpb=da12435096e47ec1d362215141fc8b21f24e5e01;p=mmh diff --git a/sbr/dtime.c b/sbr/dtime.c index 57b61c8..5d5375d 100644 --- a/sbr/dtime.c +++ b/sbr/dtime.c @@ -2,29 +2,17 @@ /* * dtime.c -- time/date routines * - * $Id$ + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include /* for snprintf() */ #include #include +#include -#if !defined(HAVE_TM_GMTOFF) && !defined(HAVE_TZSET) -# include -#endif - -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#if !defined(HAVE_TM_GMTOFF) && defined(HAVE_TZSET) +#if !defined(HAVE_STRUCT_TM_TM_GMTOFF) extern int daylight; extern long timezone; extern char *tzname[]; @@ -138,10 +126,6 @@ dlocaltime (time_t *clock) static struct tws tw; struct tm *tm; -#if !defined(HAVE_TM_GMTOFF) && !defined(HAVE_TZSET) - struct timeb tb; -#endif - if (!clock) return NULL; @@ -165,18 +149,13 @@ dlocaltime (time_t *clock) if (tm->tm_isdst) tw.tw_flags |= TW_DST; -#ifdef HAVE_TM_GMTOFF +#ifdef HAVE_STRUCT_TM_TM_GMTOFF tw.tw_zone = tm->tm_gmtoff / 60; if (tm->tm_isdst) /* if DST is in effect */ tw.tw_zone -= 60; /* reset to normal offset */ #else -# ifdef HAVE_TZSET tzset(); tw.tw_zone = -(timezone / 60); -# else - ftime (&tb); - tw.tw_zone = -tb.timezone; -# endif #endif tw.tw_flags &= ~TW_SDAY; @@ -366,14 +345,8 @@ dtimezone (int offset, int flags) } if (!(flags & TW_ZONE) && mins == 0) { -#if defined(HAVE_TZSET) && defined(HAVE_TZNAME) tzset(); return ((flags & TW_DST) ? tzname[1] : tzname[0]); -#else - for (z = zones; z->std; z++) - if (z->shift == hours) - return (z->dst && (flags & TW_DST) ? z->dst : z->std); -#endif } #ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST @@ -412,8 +385,11 @@ dmktime (struct tws *tw) year = tw->tw_year; result = 0; - if (year < 100) - year += 1900; + if (year < 1970) + year += 1900; + + if (year < 1970) + year += 100; for (i = 1970; i < year; i++) result += dysize (i);