]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
difftime is pure, not const
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 27 May 2024 00:37:17 +0000 (17:37 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 27 May 2024 16:10:00 +0000 (09:10 -0700)
Because difftime's behavior depends on the floating-point environment,
the function is pure, not const (BZ 31802).

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
time/time.h

index bc043188e1dbebbd4a49d5c5590becfaa16cf94e..486367f7dd7da5cb9e75740bf9413ac5a4002021 100644 (file)
@@ -77,7 +77,7 @@ 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__ ((__const__));
+     __THROW __attribute_pure__;
 
 /* Return the `time_t' representation of TP and normalize TP.  */
 extern time_t mktime (struct tm *__tp) __THROW;
@@ -85,7 +85,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__ ((__const__));
+                              __difftime64) __attribute_pure__;
 extern time_t __REDIRECT_NTH (mktime, (struct tm *__tp), __mktime64);
 # else
 #  define time __time64