X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fdtime.c;h=2e978d7984f6217c47f4b401b02fc77dd699d2ed;hp=8de4b69cf7e231bb1ee1a12e99bf10a3c4ebde63;hb=5dd6771b28c257af405d7248639ed0e3bcdce38b;hpb=5f80fdd1ec6888f34af829208fd90fb9716ac289 diff --git a/sbr/dtime.c b/sbr/dtime.c index 8de4b69..2e978d7 100644 --- a/sbr/dtime.c +++ b/sbr/dtime.c @@ -2,14 +2,16 @@ /* * 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 -#if !defined(HAVE_TM_GMTOFF) && !defined(HAVE_TZSET) +#if !defined(HAVE_STRUCT_TM_TM_GMTOFF) && !defined(HAVE_TZSET) # include #endif @@ -24,7 +26,7 @@ # endif #endif -#if !defined(HAVE_TM_GMTOFF) && defined(HAVE_TZSET) +#if !defined(HAVE_STRUCT_TM_TM_GMTOFF) && defined(HAVE_TZSET) extern int daylight; extern long timezone; extern char *tzname[]; @@ -138,7 +140,7 @@ dlocaltime (time_t *clock) static struct tws tw; struct tm *tm; -#if !defined(HAVE_TM_GMTOFF) && !defined(HAVE_TZSET) +#if !defined(HAVE_STRUCT_TM_TM_GMTOFF) && !defined(HAVE_TZSET) struct timeb tb; #endif @@ -165,7 +167,7 @@ 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 */ @@ -376,10 +378,10 @@ dtimezone (int offset, int flags) #endif } -#if defined(DSTXXX) +#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST if (flags & TW_DST) hours += 1; -#endif /* defined(DSTXXX) */ +#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */ snprintf (buffer, sizeof(buffer), "%s%02d%02d", offset < 0 ? "-" : "+", abs (hours), abs (mins)); return buffer; @@ -412,8 +414,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);