From cafef3eb21db24f2e8113b0adc12c0f15d4dec41 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 28 May 2024 10:07:47 -0700 Subject: [PATCH] difftime can throw exceptions difftime can signal an inexact conversion when converting to double, so it should not be marked as pure or nothrow (BZ 31808). Although we could do something more complicated, in which difftime is plain on modern platforms but const and nothrow on obsolescent platforms with 32-bit time_t, it hardly seems worth the trouble. difftime is used so rarely that it's not worth taking pains to optimize calls to it on obsolescent platforms. Reviewed-by: DJ Delorie --- time/time.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/time/time.h b/time/time.h index 486367f7dd..b6b439a452 100644 --- a/time/time.h +++ b/time/time.h @@ -76,8 +76,7 @@ extern clock_t clock (void) __THROW; extern time_t time (time_t *__timer) __THROW; /* Return the difference between TIME1 and TIME0. */ -extern double difftime (time_t __time1, time_t __time0) - __THROW __attribute_pure__; +extern double difftime (time_t __time1, time_t __time0); /* Return the `time_t' representation of TP and normalize TP. */ extern time_t mktime (struct tm *__tp) __THROW; @@ -85,7 +84,7 @@ extern time_t mktime (struct tm *__tp) __THROW; # ifdef __REDIRECT_NTH extern time_t __REDIRECT_NTH (time, (time_t *__timer), __time64); extern double __REDIRECT_NTH (difftime, (time_t __time1, time_t __time0), - __difftime64) __attribute_pure__; + __difftime64); extern time_t __REDIRECT_NTH (mktime, (struct tm *__tp), __mktime64); # else # define time __time64