Patchwork [5/8] Simplify definition of __time64_t.

login
register
mail settings
Submitter Zack Weinberg
Date March 11, 2019, 2:59 p.m.
Message ID <0ce3e22e38068c9857553dcd287c67d792a9f56b.1552315664.git.zackw@panix.com>
Download mbox | patch
Permalink /patch/31811/
State New
Headers show

Comments

Zack Weinberg - March 11, 2019, 2:59 p.m.
bits/time64.h always sets __TIME64_T_TYPE to be __time_t when
__TIMESIZE == 64, so we can unconditionally use __TIME64_T_TYPE to
define __time64_t; we don’t need another conditional in bits/types.h.

Also move the definition of __time64_t next to the definition of
__time_t.

	* posix/bits/types.h (__time64_t): Unconditionally define
        as __TIME64_T_TYPE.  Move definition next to __time_t.
---
 posix/bits/types.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
Florian Weimer - May 22, 2019, 2:44 p.m.
* Zack Weinberg:

> 	* posix/bits/types.h (__time64_t): Unconditionally define
>         as __TIME64_T_TYPE.  Move definition next to __time_t.

I think this is okay.

Thanks,
Florian

Patch

diff --git a/posix/bits/types.h b/posix/bits/types.h
index 9ddbe8733c..1f079505a7 100644
--- a/posix/bits/types.h
+++ b/posix/bits/types.h
@@ -158,6 +158,7 @@  __STD_TYPE __RLIM_T_TYPE __rlim_t;	/* Type for resource measurement.  */
 __STD_TYPE __RLIM64_T_TYPE __rlim64_t;	/* Type for resource measurement (LFS).  */
 __STD_TYPE __ID_T_TYPE __id_t;		/* General type for IDs.  */
 __STD_TYPE __TIME_T_TYPE __time_t;	/* Seconds since the Epoch.  */
+__STD_TYPE __TIME64_T_TYPE __time64_t;	/* Seconds since the Epoch (Y2038).  */
 __STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds.  */
 __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds.  */
 
@@ -213,12 +214,6 @@  __STD_TYPE __U32_TYPE __socklen_t;
    It is not currently necessary for this to be machine-specific.  */
 typedef int __sig_atomic_t;
 
-#if __TIMESIZE == 64
-# define __time64_t __time_t
-#else
-__STD_TYPE __TIME64_T_TYPE __time64_t;	/* Seconds since the Epoch.  */
-#endif
-
 /* BSD: Size of a general-purpose integer register.  */
 __STD_TYPE __REGISTER_T_TYPE __register_t;