This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Defining timespec in time.h or sys/time.h?


On Wed, Oct 18, 2017 at 7:27 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Wed, 18 Oct 2017, Steve Ellcey wrote:
>
>> It looks like the older sys/time.h would include time.h but the current one
>> doesn't.  Is this change intentional?  I am guessing it is.  Does the ISO C11
>> standard says that you need to include time.h and not sys/time.h to get
>> the timespec structure?  I don't have a copy of the standard but that would
>> seem to be the implication of this code in the current time.h:
>
> There is no such header as sys/time.h (or indeed sys/anything.h) in ISO C.
> There is also no such header in base POSIX; sys/time.h is XSI only.
> sys/time.h is permitted to include sys/select.h which is permitted to
> include time.h, but there is no requirement for it to do so.

Adding to this: struct timespec has always been specified to live in
time.h; it potentially appears in sys/time.h *only* by virtue of the
"is allowed to include" chain through sys/select.h.  Also, almost
everything specified by POSIX for sys/time.h is "OBSOLESCENT" as of
Issue 7 (the only exceptions are struct timeval, select(), and
utimes()), which means the header itself is probably on the way out.

(This is maybe a little premature of POSIX, considering that setitimer
can do things timer_* can't, but that's another discussion.)

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]