Bug 247701 - CLOCK_REALTIME is not visible when _XOPEN_SOURCE == 500 or _POSIX_C_SOURCE == 199506
Summary: CLOCK_REALTIME is not visible when _XOPEN_SOURCE == 500 or _POSIX_C_SOURCE ==...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-standards (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-02 01:33 UTC by Jan Beich
Modified: 2020-07-21 08:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2020-07-02 01:33:32 UTC
When old POSIX conformance is requested FreeBSD for some reason hides CLOCK_REALTIME to a later version.

Issue 7:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html

Issue 5:
https://pubs.opengroup.org/onlinepubs/007908799/xsh/clock_settime.html
https://pubs.opengroup.org/onlinepubs/007908799/xsh/time.h.html

$ cc a.c
a.c:7:17: error: use of undeclared identifier 'CLOCK_REALTIME'
  clock_gettime(CLOCK_REALTIME, &tp);
                ^
1 error generated.

$ cat a.c
#define _XOPEN_SOURCE 500
#include <time.h>

int main()
{
  struct timespec tp;
  clock_gettime(CLOCK_REALTIME, &tp);

  return 0;
}
Comment 1 Konstantin Belousov freebsd_committer 2020-07-03 14:22:00 UTC
https://reviews.freebsd.org/D25554
Comment 2 commit-hook freebsd_committer 2020-07-14 20:23:46 UTC
A commit references this bug:

Author: kib
Date: Tue Jul 14 20:23:28 UTC 2020
New revision: 363193
URL: https://svnweb.freebsd.org/changeset/base/363193

Log:
  Make CLOCK_REALTIME and TIMER_ABSTIME available for XOPEN_SOURCE >= 500.

  Reported by:	jbeich
  PR:	247701
  Reviewed by:	jilles
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D25554

Changes:
  head/include/time.h
  head/sys/sys/time.h
Comment 3 commit-hook freebsd_committer 2020-07-21 08:13:20 UTC
A commit references this bug:

Author: kib
Date: Tue Jul 21 08:12:53 UTC 2020
New revision: 363385
URL: https://svnweb.freebsd.org/changeset/base/363385

Log:
  MFC r363193:
  Make CLOCK_REALTIME and TIMER_ABSTIME available for XOPEN_SOURCE >= 500.

  PR:	247701

Changes:
_U  stable/12/
  stable/12/include/time.h
  stable/12/sys/sys/time.h
Comment 4 commit-hook freebsd_committer 2020-07-21 08:14:22 UTC
A commit references this bug:

Author: kib
Date: Tue Jul 21 08:13:35 UTC 2020
New revision: 363386
URL: https://svnweb.freebsd.org/changeset/base/363386

Log:
  MFC r363193:
  Make CLOCK_REALTIME and TIMER_ABSTIME available for XOPEN_SOURCE >= 500.

  PR:	247701

Changes:
_U  stable/11/
  stable/11/include/time.h
  stable/11/sys/sys/time.h