[1/5] time: Introduce glibc's internal struct __itimerspec64

Message ID 20191111214758.3677-2-lukma@denx.de
State Committed
Headers

Commit Message

Lukasz Majewski Nov. 11, 2019, 9:47 p.m. UTC
  This change provides the glibc's internal struct itimerspec representation,
which is explicitly supporting 64 bit time (by using struct __timespec64).

Such representation is necessary to provide correct time after Y2038
(time_t overflow) on devides with __TIMESIZE == 32.
---
 include/time.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
  

Comments

Lukasz Majewski Nov. 27, 2019, 4:59 p.m. UTC | #1
Dear All,

> This change provides the glibc's internal struct itimerspec
> representation, which is explicitly supporting 64 bit time (by using
> struct __timespec64).
> 
> Such representation is necessary to provide correct time after Y2038
> (time_t overflow) on devides with __TIMESIZE == 32.
> ---
>  include/time.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/include/time.h b/include/time.h
> index d7800eb30f..52ee213669 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -82,6 +82,17 @@ struct __timespec64
>  };
>  #endif
>  
> +#if __TIMESIZE == 64
> +# define __itimerspec64 itimerspec
> +#else
> +/* The glibc's internal representation of the struct itimerspec.  */
> +struct __itimerspec64
> +{
> +  struct __timespec64 it_interval;
> +  struct __timespec64 it_value;
> +};
> +#endif
> +
>  #if __TIMESIZE == 64
>  # define __ctime64 ctime
>  #else

Gentle ping.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
  
Adhemerval Zanella Netto Dec. 4, 2019, 7:41 p.m. UTC | #2
On 11/11/2019 18:47, Lukasz Majewski wrote:
> This change provides the glibc's internal struct itimerspec representation,
> which is explicitly supporting 64 bit time (by using struct __timespec64).
> 
> Such representation is necessary to provide correct time after Y2038
> (time_t overflow) on devides with __TIMESIZE == 32.

LGTM, thanks.

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

> ---
>  include/time.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/include/time.h b/include/time.h
> index d7800eb30f..52ee213669 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -82,6 +82,17 @@ struct __timespec64
>  };
>  #endif
>  
> +#if __TIMESIZE == 64
> +# define __itimerspec64 itimerspec
> +#else
> +/* The glibc's internal representation of the struct itimerspec.  */
> +struct __itimerspec64
> +{
> +  struct __timespec64 it_interval;
> +  struct __timespec64 it_value;
> +};
> +#endif
> +
>  #if __TIMESIZE == 64
>  # define __ctime64 ctime
>  #else
> 

Ok, __timespec64 already handles both the padding and endianess.
  

Patch

diff --git a/include/time.h b/include/time.h
index d7800eb30f..52ee213669 100644
--- a/include/time.h
+++ b/include/time.h
@@ -82,6 +82,17 @@  struct __timespec64
 };
 #endif
 
+#if __TIMESIZE == 64
+# define __itimerspec64 itimerspec
+#else
+/* The glibc's internal representation of the struct itimerspec.  */
+struct __itimerspec64
+{
+  struct __timespec64 it_interval;
+  struct __timespec64 it_value;
+};
+#endif
+
 #if __TIMESIZE == 64
 # define __ctime64 ctime
 #else