This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC v2 07/20] sysdeps/gettimeofday: Use clock_gettime64 if avaliable
- From: Florian Weimer <fweimer at redhat dot com>
- To: Arnd Bergmann <arnd at arndb dot de>
- Cc: Zack Weinberg <zackw at panix dot com>, Paul Eggert <eggert at cs dot ucla dot edu>, Alistair Francis <alistair23 at gmail dot com>, Joseph Myers <joseph at codesourcery dot com>, Alistair Francis <alistair dot francis at wdc dot com>, GNU C Library <libc-alpha at sourceware dot org>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Palmer Dabbelt <palmer at sifive dot com>, macro at wdc dot com, Zong Li <zongbox at gmail dot com>, Zong Li <zong at andestech dot com>
- Date: Fri, 26 Jul 2019 15:01:48 +0200
- Subject: Re: [RFC v2 07/20] sysdeps/gettimeofday: Use clock_gettime64 if avaliable
- References: <cover.1561421042.git.alistair.francis@wdc.com> <cb015d0d1d29e4b948c7118c5b12ff2bed83a6ec.1561421042.git.alistair.francis@wdc.com> <alpine.DEB.2.21.1907242013260.2807@digraph.polyomino.org.uk> <CAKmqyKP1EGAqQE+vvOH=wp5dp+YH=GofLTniU_wFeLT4BDp4oQ@mail.gmail.com> <CAK8P3a0f-N6DsjjBAvY-Y3sza703fYe55h7pVzhvZXGEqe7G-Q@mail.gmail.com> <4ec24dc5-ca74-82cd-5116-c6d76688765f@cs.ucla.edu> <CAKCAbMiQuPbX1RK24jStZRyXuueaMMFOUjWSU+JS+Lrtssk0Xw@mail.gmail.com> <CAK8P3a1ZTFFdsbp4DNKZeYU45yvJGm2NLE2ZGm8DOerw1MwmFg@mail.gmail.com>
* Arnd Bergmann:
> On Thu, Jul 25, 2019 at 7:21 PM Zack Weinberg <zackw@panix.com> wrote:
>>
>> On Thu, Jul 25, 2019 at 1:03 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
>> >
>> > Arnd Bergmann wrote:
>> > > If we want to keep
>> > > the traditional settimeofday()/gettimeofday() behavior working, a new
>> > > kernel interface could be added
>> >
>> > Let's not. That behavior was a bad idea even in the 1980s, and applications
>> > stopped using it decades ago. It has been completely obsoleted by TZ strings.
>>
>> Do we think we could get away with having both functions fail (with
>> EINVAL) whenever the tz argument is non-null?
>
> From my findings at Debian code search, I found code like
>
> struct timeval my_gettime(void)
> {
> struct timezone tz_ignored;
> struct timeval tv;
> gettimeofday(&tv, &tz_ignored);
> return tv;
> }
>
> In this case, the safer choice would be to silently ignore it.
>
> Another alternative would be to hide the definition of 'struct timezone'
> in the libc headers and only leave a forward declaration.
Renaming the struct timezone members might be sufficient. Then the code
above would still compile, but something that actually depends on the
struct timezone data would not.
Thanks,
Florian