diff options
| author | Paul Eggert | 1997-07-08 01:02:06 +0000 |
|---|---|---|
| committer | Paul Eggert | 1997-07-08 01:02:06 +0000 |
| commit | 6385ec2bd4ba58b3f1f260178b3925bccf41b0a8 (patch) | |
| tree | 9474973f6fba68c40c203813f25a2adbea1464c4 /src | |
| parent | cd9012b5bb935c171038efa0e4d6db3e5086dec3 (diff) | |
| download | emacs-6385ec2bd4ba58b3f1f260178b3925bccf41b0a8.tar.gz emacs-6385ec2bd4ba58b3f1f260178b3925bccf41b0a8.zip | |
automatically generated from GPLed version
Diffstat (limited to 'src')
| -rw-r--r-- | src/mktime.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/mktime.c b/src/mktime.c index 495ee37b1b0..67769fca46d 100644 --- a/src/mktime.c +++ b/src/mktime.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | /* #define DEBUG 1 */ | 24 | /* #define DEBUG 1 */ |
| 25 | 25 | ||
| 26 | #ifdef HAVE_CONFIG_H | 26 | #ifdef HAVE_CONFIG_H |
| 27 | #include <config.h> | 27 | # include <config.h> |
| 28 | #endif | 28 | #endif |
| 29 | 29 | ||
| 30 | #ifdef _LIBC | 30 | #ifdef _LIBC |
| @@ -37,50 +37,52 @@ | |||
| 37 | If the host has a `zic' command with a `-L leapsecondfilename' option, | 37 | If the host has a `zic' command with a `-L leapsecondfilename' option, |
| 38 | then it supports leap seconds; otherwise it probably doesn't. */ | 38 | then it supports leap seconds; otherwise it probably doesn't. */ |
| 39 | #ifndef LEAP_SECONDS_POSSIBLE | 39 | #ifndef LEAP_SECONDS_POSSIBLE |
| 40 | #define LEAP_SECONDS_POSSIBLE 1 | 40 | # define LEAP_SECONDS_POSSIBLE 1 |
| 41 | #endif | 41 | #endif |
| 42 | 42 | ||
| 43 | #include <sys/types.h> /* Some systems define `time_t' here. */ | 43 | #include <sys/types.h> /* Some systems define `time_t' here. */ |
| 44 | #include <time.h> | 44 | #include <time.h> |
| 45 | 45 | ||
| 46 | #if HAVE_LIMITS_H | 46 | #if HAVE_LIMITS_H |
| 47 | #include <limits.h> | 47 | # include <limits.h> |
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
| 50 | #if DEBUG | 50 | #if DEBUG |
| 51 | #include <stdio.h> | 51 | # include <stdio.h> |
| 52 | #if STDC_HEADERS | 52 | # if STDC_HEADERS |
| 53 | #include <stdlib.h> | 53 | # include <stdlib.h> |
| 54 | #endif | 54 | # endif |
| 55 | /* Make it work even if the system's libc has its own mktime routine. */ | 55 | /* Make it work even if the system's libc has its own mktime routine. */ |
| 56 | #define mktime my_mktime | 56 | # define mktime my_mktime |
| 57 | #endif /* DEBUG */ | 57 | #endif /* DEBUG */ |
| 58 | 58 | ||
| 59 | #ifndef __P | 59 | #ifndef __P |
| 60 | #if defined (__GNUC__) || (defined (__STDC__) && __STDC__) | 60 | # if defined (__GNUC__) || (defined (__STDC__) && __STDC__) |
| 61 | #define __P(args) args | 61 | # define __P(args) args |
| 62 | #else | 62 | # else |
| 63 | #define __P(args) () | 63 | # define __P(args) () |
| 64 | #endif /* GCC. */ | 64 | # endif /* GCC. */ |
| 65 | #endif /* Not __P. */ | 65 | #endif /* Not __P. */ |
| 66 | 66 | ||
| 67 | #ifndef CHAR_BIT | 67 | #ifndef CHAR_BIT |
| 68 | #define CHAR_BIT 8 | 68 | # define CHAR_BIT 8 |
| 69 | #endif | 69 | #endif |
| 70 | 70 | ||
| 71 | #ifndef INT_MIN | 71 | #ifndef INT_MIN |
| 72 | #define INT_MIN (~0 << (sizeof (int) * CHAR_BIT - 1)) | 72 | # define INT_MIN (~0 << (sizeof (int) * CHAR_BIT - 1)) |
| 73 | #endif | 73 | #endif |
| 74 | #ifndef INT_MAX | 74 | #ifndef INT_MAX |
| 75 | #define INT_MAX (~0 - INT_MIN) | 75 | # define INT_MAX (~0 - INT_MIN) |
| 76 | #endif | 76 | #endif |
| 77 | 77 | ||
| 78 | #ifndef TIME_T_MIN | 78 | #ifndef TIME_T_MIN |
| 79 | #define TIME_T_MIN (0 < (time_t) -1 ? (time_t) 0 \ | 79 | /* The outer cast to time_t works around a bug in Cray C 5.0.3.0. */ |
| 80 | : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1)) | 80 | # define TIME_T_MIN ((time_t) \ |
| 81 | (0 < (time_t) -1 ? (time_t) 0 \ | ||
| 82 | : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))) | ||
| 81 | #endif | 83 | #endif |
| 82 | #ifndef TIME_T_MAX | 84 | #ifndef TIME_T_MAX |
| 83 | #define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN) | 85 | # define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN) |
| 84 | #endif | 86 | #endif |
| 85 | 87 | ||
| 86 | #define TM_YEAR_BASE 1900 | 88 | #define TM_YEAR_BASE 1900 |
| @@ -89,7 +91,7 @@ | |||
| 89 | #ifndef __isleap | 91 | #ifndef __isleap |
| 90 | /* Nonzero if YEAR is a leap year (every 4 years, | 92 | /* Nonzero if YEAR is a leap year (every 4 years, |
| 91 | except every 100th isn't, and every 400th is). */ | 93 | except every 100th isn't, and every 400th is). */ |
| 92 | #define __isleap(year) \ | 94 | # define __isleap(year) \ |
| 93 | ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) | 95 | ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) |
| 94 | #endif | 96 | #endif |
| 95 | 97 | ||
| @@ -109,11 +111,11 @@ time_t __mktime_internal __P ((struct tm *, | |||
| 109 | 111 | ||
| 110 | 112 | ||
| 111 | #ifdef _LIBC | 113 | #ifdef _LIBC |
| 112 | #define localtime_r __localtime_r | 114 | # define localtime_r __localtime_r |
| 113 | #else | 115 | #else |
| 114 | #if ! HAVE_LOCALTIME_R && ! defined (localtime_r) | 116 | # if ! HAVE_LOCALTIME_R && ! defined localtime_r |
| 115 | /* Approximate localtime_r as best we can in its absence. */ | 117 | /* Approximate localtime_r as best we can in its absence. */ |
| 116 | #define localtime_r my_localtime_r | 118 | # define localtime_r my_mktime_localtime_r |
| 117 | static struct tm *localtime_r __P ((const time_t *, struct tm *)); | 119 | static struct tm *localtime_r __P ((const time_t *, struct tm *)); |
| 118 | static struct tm * | 120 | static struct tm * |
| 119 | localtime_r (t, tp) | 121 | localtime_r (t, tp) |
| @@ -126,7 +128,7 @@ localtime_r (t, tp) | |||
| 126 | *tp = *l; | 128 | *tp = *l; |
| 127 | return tp; | 129 | return tp; |
| 128 | } | 130 | } |
| 129 | #endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */ | 131 | # endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */ |
| 130 | #endif /* ! _LIBC */ | 132 | #endif /* ! _LIBC */ |
| 131 | 133 | ||
| 132 | 134 | ||