aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2024-05-28 10:07:47 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2024-06-04 09:04:04 -0700
commitcafef3eb21db24f2e8113b0adc12c0f15d4dec41 (patch)
tree99e57ba69fc826c2cad30f948d347d6a898d86d4
parent127fc56152347d73cb7c1c283e60e1cb1f15e9f9 (diff)
downloadglibc-cafef3eb21db24f2e8113b0adc12c0f15d4dec41.zip
glibc-cafef3eb21db24f2e8113b0adc12c0f15d4dec41.tar.gz
glibc-cafef3eb21db24f2e8113b0adc12c0f15d4dec41.tar.bz2
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 <dj@redhat.com>
-rw-r--r--time/time.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/time/time.h b/time/time.h
index 486367f..b6b439a 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