diff options
| author | djm <> | 2005-04-29 05:37:34 +0000 |
|---|---|---|
| committer | djm <> | 2005-04-29 05:37:34 +0000 |
| commit | a95585a25ab25668b931a78b7543f707a3354db8 (patch) | |
| tree | f9e9febf7ac0c8f5d6df761fe70fd613aac06203 /src/lib/libcrypto/o_time.c | |
| parent | 58c08aa241f168c84ce7cc3052454ea59a44eada (diff) | |
| download | openbsd-a95585a25ab25668b931a78b7543f707a3354db8.tar.gz openbsd-a95585a25ab25668b931a78b7543f707a3354db8.tar.bz2 openbsd-a95585a25ab25668b931a78b7543f707a3354db8.zip | |
import of openssl-0.9.7g; tested on platforms from alpha to zaurus, ok deraadt@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/o_time.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/lib/libcrypto/o_time.c b/src/lib/libcrypto/o_time.c index 785468131e..e29091d650 100644 --- a/src/lib/libcrypto/o_time.c +++ b/src/lib/libcrypto/o_time.c | |||
| @@ -114,16 +114,28 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) | |||
| 114 | return NULL; | 114 | return NULL; |
| 115 | logvalue[reslen] = '\0'; | 115 | logvalue[reslen] = '\0'; |
| 116 | 116 | ||
| 117 | t = *timer; | ||
| 118 | |||
| 119 | /* The following is extracted from the DEC C header time.h */ | ||
| 120 | /* | ||
| 121 | ** Beginning in OpenVMS Version 7.0 mktime, time, ctime, strftime | ||
| 122 | ** have two implementations. One implementation is provided | ||
| 123 | ** for compatibility and deals with time in terms of local time, | ||
| 124 | ** the other __utc_* deals with time in terms of UTC. | ||
| 125 | */ | ||
| 126 | /* We use the same conditions as in said time.h to check if we should | ||
| 127 | assume that t contains local time (and should therefore be adjusted) | ||
| 128 | or UTC (and should therefore be left untouched). */ | ||
| 129 | #if __CRTL_VER < 70000000 || defined _VMS_V6_SOURCE | ||
| 117 | /* Get the numerical value of the equivalence string */ | 130 | /* Get the numerical value of the equivalence string */ |
| 118 | status = atoi(logvalue); | 131 | status = atoi(logvalue); |
| 119 | 132 | ||
| 120 | /* and use it to move time to GMT */ | 133 | /* and use it to move time to GMT */ |
| 121 | t = *timer - status; | 134 | t -= status; |
| 135 | #endif | ||
| 122 | 136 | ||
| 123 | /* then convert the result to the time structure */ | 137 | /* then convert the result to the time structure */ |
| 124 | #ifndef OPENSSL_THREADS | 138 | |
| 125 | ts=(struct tm *)localtime(&t); | ||
| 126 | #else | ||
| 127 | /* Since there was no gmtime_r() to do this stuff for us, | 139 | /* Since there was no gmtime_r() to do this stuff for us, |
| 128 | we have to do it the hard way. */ | 140 | we have to do it the hard way. */ |
| 129 | { | 141 | { |
| @@ -198,7 +210,6 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) | |||
| 198 | result->tm_isdst = 0; /* There's no way to know... */ | 210 | result->tm_isdst = 0; /* There's no way to know... */ |
| 199 | 211 | ||
| 200 | ts = result; | 212 | ts = result; |
| 201 | #endif | ||
| 202 | } | 213 | } |
| 203 | } | 214 | } |
| 204 | #endif | 215 | #endif |
