aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test/test_util.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index e1f77b9636..a75b6bb14b 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -471,7 +471,8 @@ test_util_time(void *arg)
b_time.tm_year == (1901-1900));
}
- if (sizeof(time_t) == 8) {
+#if SIZEOF_TIME_T == 8
+ {
/* one of the smallest tm_year values my 64 bit system supports:
* b_time.tm_year == (-292275055LL-1900LL) without clamping */
t_res = -9223372036854775LL;
@@ -490,11 +491,13 @@ test_util_time(void *arg)
tt_assert(b_time.tm_year == (1970-1900) ||
b_time.tm_year == (1-1900));
}
+#endif
/* time_t >= INT_MAX yields a year clamped to 2037 or 9999,
* depending on whether the implementation of the system gmtime(_r)
* sets struct tm (9999) or not (2037) */
- if (sizeof(time_t) == 4 || sizeof(time_t) == 8) {
+#if SIZEOF_TIME_T == 4 || SIZEOF_TIME_T == 8
+ {
t_res = 3*(1 << 29);
tor_gmtime_r(&t_res, &b_time);
tt_assert(b_time.tm_year == (2021-1900));
@@ -504,8 +507,10 @@ test_util_time(void *arg)
tt_assert(b_time.tm_year == (2037-1900) ||
b_time.tm_year == (2038-1900));
}
+#endif
- if (sizeof(time_t) == 8) {
+#if SIZEOF_TIME_T == 8
+ {
/* one of the largest tm_year values my 64 bit system supports:
* b_time.tm_year == (292278994L-1900L) without clamping */
t_res = 9223372036854775LL;
@@ -524,6 +529,7 @@ test_util_time(void *arg)
tt_assert(b_time.tm_year == (2037-1900) ||
b_time.tm_year == (9999-1900));
}
+#endif
/* Test {format,parse}_rfc1123_time */