This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v9] y2038: Provide conversion helpers for struct __timespec64
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Lukasz Majewski <lukma at denx dot de>
- Cc: Alistair Francis <alistair23 at gmail dot com>, Alistair Francis <alistair dot francis at wdc dot com>, Florian Weimer <fw at deneb dot enyo dot de>, Zack Weinberg <zackw at panix dot com>, Arnd Bergmann <arnd at arndb dot de>, GNU C Library <libc-alpha at sourceware dot org>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Florian Weimer <fweimer at redhat dot com>, Carlos O'Donell <carlos at redhat dot com>, Stepan Golosunov <stepan at golosunov dot pp dot ru>
- Date: Thu, 26 Sep 2019 22:19:43 +0000
- Subject: Re: [PATCH v9] y2038: Provide conversion helpers for struct __timespec64
- Ironport-sdr: holgOzoQsnRHl9qlIJk9l5sMvisTs3Gg/RV7hjST2yRdONzgCDHnuguyUzNOnfz5xjyAM0aSSj XSmd3IGmJcA666t3qZUKlY0aHe/3gaZGY0UPJ3IvcGvhOUYwqVkVbrCMNwW5W15UVWvBc7QS7Q 925a+pqr1iu4E7GdVMYqmxp3S0jgUmFyPOkuRwxqrQeKcZS9Y9EZisZNNtvZOl8+I5xMaS5YN9 Dh0oM9FlhZmAPetin4HErOzFZOnGU5SvHSBNihDkH0enirQgOqIreTr6ejUSjjWS1re2aKGkFk 1Bw=
- Ironport-sdr: CW3lXTbQWsfNSxzF3dgnI0XTCVsGLUcjf6kwHNA9JduHr8A2kljvdLAlhYa6RZUMXdvPSz32IH CzGHzV5z2U7UMRl8GtiJwTTQ39TVNPuSLLjdTKLdAszgbcF2Nnea6jPV8e6FqvxcAw4hMBwZG6 x/YtY7WQ7zK5ySjdlVCZVS7/OjizqwA79ywMZWPxlm4qiHlyx9dak8XiVJUaFXyNBOsmYUMxFw e/lCziUay52RpAJxeAmb22CFu3ixofe+chW1NFdE0RkkKVVBad0mpWXFAfQoKRO6oiuksAzqCo u+U=
- References: <20190926215547.14522-1-lukma@denx.de>
On Thu, 26 Sep 2019, Lukasz Majewski wrote:
> Those functions allow easy conversion between Y2038 safe struct
> __timespec64 and other time related data structures (like struct timeval).
>
> * include/time.h (valid_timeval_to_timespec64): Add.
> * include/time.h (valid_timespec_to_timespec64): Likewise.
> * include/time.h (valid_timespec64_to_timespec): Likewise.
> * include/time.h (valid_timespec64_to_timeval): Likewise.
> * include/time.h (IS_VALID_NANOSECONDS): Likewise.
> * include/time.h (timespec_to_timespec64): Likewise.
> * include/time.h (timespec64_to_timespec): Likewise.
> * include/time.h (timespec64_to_timeval): Likewise.
OK, though we'll need to watch users of these interfaces carefully to see
if timespec64_to_timespec and timespec64_to_timeval are the best
interfaces for the contexts in which they are used. (The issue is that
they return false in two different cases, invalid nanoseconds which would
typically be an EINVAL error and out-of-range seconds which would be
EOVERFLOW. So in any case where the caller needs to distinguish those
conditions to determine what value to use for errno, it would need to
repeat one of the checks from those functions. But maybe the compiler
could optimize the code generated so it doesn't actually end up with a
duplicate of the nanoseconds range test.)
--
Joseph S. Myers
joseph@codesourcery.com