diff options
author | deraadt <> | 2014-06-07 15:06:24 +0000 |
---|---|---|
committer | deraadt <> | 2014-06-07 15:06:24 +0000 |
commit | acc9efcd81c21f083ddd54c813e692ffd635cc6a (patch) | |
tree | 8c109a1ee473f778c99439e5209def2f14539e9f /src/lib/libcrypto/o_time.c | |
parent | bc5befed3a1330da031774725e30bd7b82390823 (diff) | |
download | openbsd-acc9efcd81c21f083ddd54c813e692ffd635cc6a.tar.gz openbsd-acc9efcd81c21f083ddd54c813e692ffd635cc6a.tar.bz2 openbsd-acc9efcd81c21f083ddd54c813e692ffd635cc6a.zip |
Remove various test stubs. The good ones have been moved by jsing
and others to the regress framework. These remaining ones just
muddle us up when re-reading code repeatedly.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/o_time.c')
-rw-r--r-- | src/lib/libcrypto/o_time.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/lib/libcrypto/o_time.c b/src/lib/libcrypto/o_time.c index 45bfce742e..a963b0d120 100644 --- a/src/lib/libcrypto/o_time.c +++ b/src/lib/libcrypto/o_time.c | |||
@@ -159,53 +159,3 @@ julian_to_date(long jd, int *y, int *m, int *d) | |||
159 | *m = j + 2 - (12 * L); | 159 | *m = j + 2 - (12 * L); |
160 | *y = 100 * (n - 49) + i + L; | 160 | *y = 100 * (n - 49) + i + L; |
161 | } | 161 | } |
162 | |||
163 | #ifdef OPENSSL_TIME_TEST | ||
164 | |||
165 | #include <stdio.h> | ||
166 | |||
167 | /* Time checking test code. Check times are identical for a wide range of | ||
168 | * offsets. This should be run on a machine with 64 bit time_t or it will | ||
169 | * trigger the very errors the routines fix. | ||
170 | */ | ||
171 | |||
172 | int | ||
173 | main(int argc, char **argv) | ||
174 | { | ||
175 | long offset; | ||
176 | for (offset = 0; offset < 1000000; offset++) { | ||
177 | check_time(offset); | ||
178 | check_time(-offset); | ||
179 | check_time(offset * 1000); | ||
180 | check_time(-offset * 1000); | ||
181 | } | ||
182 | } | ||
183 | |||
184 | int | ||
185 | check_time(long offset) | ||
186 | { | ||
187 | struct tm tm1, tm2; | ||
188 | time_t t1, t2; | ||
189 | time(&t1); | ||
190 | t2 = t1 + offset; | ||
191 | gmtime_r(&t2, &tm2); | ||
192 | gmtime_r(&t1, &tm1); | ||
193 | OPENSSL_gmtime_adj(&tm1, 0, offset); | ||
194 | if ((tm1.tm_year == tm2.tm_year) && | ||
195 | (tm1.tm_mon == tm2.tm_mon) && | ||
196 | (tm1.tm_mday == tm2.tm_mday) && | ||
197 | (tm1.tm_hour == tm2.tm_hour) && | ||
198 | (tm1.tm_min == tm2.tm_min) && | ||
199 | (tm1.tm_sec == tm2.tm_sec)) | ||
200 | return 1; | ||
201 | fprintf(stderr, "TIME ERROR!!\n"); | ||
202 | fprintf(stderr, "Time1: %d/%d/%d, %d:%02d:%02d\n", | ||
203 | tm2.tm_mday, tm2.tm_mon + 1, tm2.tm_year + 1900, | ||
204 | tm2.tm_hour, tm2.tm_min, tm2.tm_sec); | ||
205 | fprintf(stderr, "Time2: %d/%d/%d, %d:%02d:%02d\n", | ||
206 | tm1.tm_mday, tm1.tm_mon + 1, tm1.tm_year + 1900, | ||
207 | tm1.tm_hour, tm1.tm_min, tm1.tm_sec); | ||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | #endif | ||