time_t result = 0;
long current = 0;
- time_t max_time = (uintmax_t) (~(time_t)0) >> 1;
-
while (*p) {
char *endp;
int mul;
current *= mul;
- if (current > max_time - result)
+ if (current > MAX_TEMP_TIME - result)
return MAX_TEMP_TIME;
result += current;
static void valid_temp_time_overflow(void)
{
- time_t max_time = (uintmax_t) (~(time_t)0) >> 1;
char s[100];
time_t t;
- snprintf(s, sizeof s, "%" PRIuMAX "m", (uintmax_t) max_time / 60 + 2);
+ snprintf(s, sizeof s, "%" PRIuMAX "m", UINTMAX_MAX / 60 + 2);
t = valid_temp_time(s);
is_int(52 * WEEK, t, MSG);
- snprintf(s, sizeof s, "%" PRIuMAX "m%" PRIuMAX "m", (uintmax_t) max_time / 60 - 1, (uintmax_t) max_time / 60 - 1);
+ snprintf(s, sizeof s, "%" PRIuMAX "m%" PRIuMAX "m", UINTMAX_MAX / 60 - 1, UINTMAX_MAX / 60 - 1);
t = valid_temp_time(s);
is_int(52 * WEEK, t, MSG);
}