[Bug 231425] Fix C11 and POSIX 1003.1b-1993 compliance in time.h

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Sep 17 11:11:35 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231425

            Bug ID: 231425
           Summary: Fix C11 and POSIX 1003.1b-1993 compliance in time.h
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: standards
          Assignee: standards at FreeBSD.org
          Reporter: sghctoma at gmail.com

Created attachment 197167
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=197167&action=edit
patch to make time.h C11 and POSIX 1003.1b-1993 compliant

The problems:
 - struct timespec is only visible if _POSIX_C_SOURCE >= 199309 even though it
is in the C11 standard (ISO/IEC 9899:201x 7.27.1)
 - timespec_get is not behind any feature test macros, but it is only defined
in C11 (ISO/IEC 9899:201x 7.27.2.5)

Related headers:
 - time.h: includes timespec.h if _POSIX_C_SOURCE >= 19930, defines
timespec_get and TIME_UTC unconditionally
 - timespec.h: defines some BSD-specific macros, itimerspec, and includes
_timespec.h
 - _timespec.h: defines struct timespec

A summary of which symbols are defined in which standard:
 - itimerspec: POSIX 1003.1b-1993
 - timespec: POSIX 1003.1b-1993, C11
 - timespec_get: C11
 - TIME_UTC: C11

The patch:
I did not really know what would be the proper approach to fix this, so I went
with a solution that does not require touching _timespec.h and timespec.h. The
attached patch puts timespec_get and TIME_UTC behind __STDC_VERSION__ >=
201112L guard. It also includes _timespec.h inside that guard, so we get struct
timespec.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-standards mailing list