History log of /freebsd-current/include/time.h
Revision Date Author Comments
# a34940a9 11-Mar-2024 Warner Losh <imp@FreeBSD.org>

timezone: Move to the XSI/POSIX definition for timezone.

The old timezone(3) function has long since been obsolete and has a
fatally flawed interface. Retain this function for compatibility
purposes, but shift to providing the offset from UTC in the timezone
variable, whether or not the timezone observes summer time in the
'daylight' variable. Document the tzname variable that's already been
set. Also make _tztab() static. It's not used in libc (or anywhere in
the tree) and it's not exported as a public dynamic symbol.

Sponsored by: Netflix
Reviewed by: brooks, kib
Differential Revision: https://reviews.freebsd.org/D44281


# 5a1d1441 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

include: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 8091b82e 05-Sep-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

time.h: Fix visibility check for C11 and C23 features.

__BSD_VISIBLE is always defined; we need to check if it's true.

Fixes: d02489d11aed 9b5d724cad10
MFC after: 3 days
Reviewed by: brooks, imp
Differential Revision: https://reviews.freebsd.org/D41733


# 9b5d724c 24-Aug-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

libc: Add timespec_getres(3) as per C23.

This also adds support for TIME_MONOTONIC to timespec_get(3).

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D41524


# 42b38843 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


# a9a38dea 07-Mar-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

libc: Remove prototype and documentation for tzsetwall().

PR: 269445
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D38481


# 7b797ba2 30-Jul-2021 Warner Losh <imp@FreeBSD.org>

time.h: reduce CLOCK_ namespace pollution, move to _clock_id.h

Attempt to comply with the strict namespace pollution requirements of
_POSIX_C_SOURCE. Add guards to limit visitbility of CLOCK_ and TIMER_
defines as appropriate. Only define the CLOCK_ variables relevant to the
specific standards. Move all the sharing to sys/_clock_id.h and make
time.h and sys/time.h both include that rather than copy due to the
now large number of clocks and compat defines.

Please note: The old time.h previously used these newer dates:
CLOCK_REALTIME 199506
CLOCK_MONOTONIC 200112
CLOCK_THREAD_CPUTIME_ID 200112
CLOCK_PROCESS_CPUTIME_ID 200112

but glibc defines all of these for 199309. glibc uses this date for all
these values, however, only CLOCK_REALTIME was in IEEE 1003.1b. Add a
comment about this to document it. A large number of programs and
libraries assume that these will be defined for _POSIX_C_SOURCE =
199309.

In addition, leak CLOCK_UPTIME_FAST for the pocl package until it can be
updated to use a simple CLOCK_MONOTONIC.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31056


# aeafed21 14-Jul-2020 Konstantin Belousov <kib@FreeBSD.org>

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


# bc053caf 09-Dec-2019 Dimitry Andric <dim@FreeBSD.org>

Correctly check for C++17 and higher when declaring timespec_get()

Summary:
In rS338751, the check to declare `timespec_get()` for C++17 and higher
was incorrectly done against a `cplusplus` define, while it should have
been `__cplusplus`.

Fix this by using `__cplusplus`, and also bump `__FreeBSD_version` so it
becomes possible to correctly check for `timespec_get()` in upstream
libc++ headers.

Reviewed by: brooks, emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D22735


# d02489d1 18-Sep-2018 Brooks Davis <brooks@FreeBSD.org>

Fix C11 and POSIX 1003.1b-1993 compliance in time.h

Only expose timespec_get in C11, C++17, or BSD code. Always define
struct timespect if defining timespec_get.

PR: 231425
Reviewed by: kib
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17174


# 7e299411 10-Aug-2018 Warner Losh <imp@FreeBSD.org>

Bring in timespce_get form NetBSD.

Bring in the functionality for timespec_get from NetBSD. I've lightly
edited the .c file to remove _DIAGASSERT because FreeBSD doesn't have
that functionality and the typical #define'ing it to assert isn't
right here. The man page is verbatim from NetBSD, but will be revised
as part of a larger cleanup of the time man pages (they are
inconsistent and vague in all the wrong places).

Differential Review: https://reviews.freebsd.org/D16649


# fe9fbe22 25-May-2018 Eitan Adler <eadler@FreeBSD.org>

Add time2posix and posix2time to time.h

These are documented in `time2posix.3` but the symbols are not actually
visible. Since these are not POSIX hide them behind _BSD_VISIBLE.

Reviewed by: wollman
Differential Revision: https://reviews.freebsd.org/D15530


# ef1fcaf0 22-Feb-2018 Warner Losh <imp@FreeBSD.org>

Do not include float interfaces when using libsa.

We don't support float in the boot loaders, so don't include
interfaces for float or double in systems headers. In addition, take
the unusual step of spiking double and float to prevent any more
accidental seepage.


# 2321c474 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

include: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# 3f8455b0 18-Mar-2017 Eric van Gyzen <vangyzen@FreeBSD.org>

Add clock_nanosleep()

Add a clock_nanosleep() syscall, as specified by POSIX.
Make nanosleep() a wrapper around it.

Attach the clock_nanosleep test from NetBSD. Adjust it for the
FreeBSD behavior of updating rmtp only when interrupted by a signal.
I believe this to be POSIX-compliant, since POSIX mentions the rmtp
parameter only in the paragraph about EINTR. This is also what
Linux does. (NetBSD updates rmtp unconditionally.)

Copy the whole nanosleep.2 man page from NetBSD because it is complete
and closely resembles the POSIX description. Edit, polish, and reword it
a bit, being sure to keep any relevant text from the FreeBSD page.

Reviewed by: kib, ngie, jilles
MFC after: 3 weeks
Relnotes: yes
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10020


# ddce1c3d 02-Oct-2016 Konstantin Belousov <kib@FreeBSD.org>

Export the mq_getfd_np() symbol from librt.so, which allows to get
file descriptor for the given posix mqueue. Export the
timer_oshandle_np() symbol to get ktimer id for the given posix timer.

Requested by: Lewis Donzis <lew@perftech.com>
Reviewed by: jilles
Discussed with: kan
Sponsored by: The FreeBSD Foundation
MFC after: 1 week


# c0e8ea25 14-Jan-2013 Dimitry Andric <dim@FreeBSD.org>

Add CLOCK_PROCESS_CPUTIME_ID to <time.h>, to synchronize the CLOCK_*
values with those in <sys/time.h>. Otherwise, if a program includes
<time.h> before <sys/time.h>, the CLOCK_PROCESS_CPUTIME_ID macro never
gets defined.

Reviewed by: davidxu
X-MFC-With: 239347


# 224ee591 09-Sep-2012 David Xu <davidxu@FreeBSD.org>

Add missing prototype for clock_getcpuclockid.


# 3ac9d659 27-Mar-2012 David Chisnall <theraven@FreeBSD.org>

Correctly expose xlocale functions if people include the headers in the wrong
order (as some ports apparently do).

Approved by: dim (mentor)


# a8ed63bb 04-Mar-2012 David Chisnall <theraven@FreeBSD.org>

Reapply 227753 (xlocale cleanup), plus some fixes so that it passes build
universe with gcc.

Approved by: dim (mentor)


# b74cf6dc 14-Feb-2012 Dimitry Andric <dim@FreeBSD.org>

Revert r231673 and r231682 for now, until we can run a full make
universe with them. Sorry for the breakage.

Pointy hat to: me and brooks


# 82dd5016 13-Feb-2012 David Chisnall <theraven@FreeBSD.org>

Cleanup of xlocale:

- Address performance regressions encountered by das@ by caching per-thread
data in TLS where available.
- Add a __NO_TLS flag to cdefs.h to indicate where not available.
- Reorganise the xlocale.h definitions into xlocale/*.h so that they can be
included from multiple places.
- Export the POSIX2008 subset of xlocale when POSIX2008 says it should be
exported, independently of whether xlocale.h is included.
- Fix the bug where programs using ctype functions always assumed ASCII unless
recompiled.
- Fix some style(9) violations.

Reviewed by: brooks (mentor)
Approved by: dim (mentor)


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# f2556687 16-Feb-2010 Warner Losh <imp@FreeBSD.org>

Remove the Berkeley clause 3's.
Add a few $FreeBSD$


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 9939a136 22-Mar-2008 David Xu <davidxu@FreeBSD.org>

Add POSIX pthread API pthread_getcpuclockid() to get a thread's cpu
time clock id.


# 992879a0 14-Apr-2006 John Birrell <jb@FreeBSD.org>

Copy the new CLOCK_ defines from sys/time.h for SUSv3 compatibility.

Approved by: rwatson


# bd3e40ce 29-Oct-2005 David Xu <davidxu@FreeBSD.org>

Add POSIX timer interfaces.


# 6d2f64c1 01-Apr-2005 David Schultz <das@FreeBSD.org>

Define CLOCK_* and TIMER_* in time.h, where they are supposed to be.


# 12eb46c8 07-Dec-2003 Marcel Moolenaar <marcel@FreeBSD.org>

Change the definition of NULL on ia64 (for LP64 compilations) from
an int constant to a long constant. This change improves consistency
in the following two ways:
1. The first 8 arguments are always passed in registers on ia64, which
by virtue of the generated code implicitly widens ints to longs and
allows the use of an 32-bit integral type for 64-bit arguments.
Subsequent arguments are passed onto the memory stack, which does
not exhibit the same behaviour and consequently do not allow this.
In practice this means that variadic functions taking pointers
and given NULL (without cast) work as long as the NULL is passed
in one of the first 8 arguments. A SIGSEGV is more likely the
result if such would be done for stack-based arguments. This is
due to the fact that the upper 4 bytes remain undefined.
2. All 64-bit platforms that FreeBSD supports, with the obvious
exception of ia64, allow 32-bit integral types (specifically NULL)
when 64-bit pointers are expected in variadic functions by way of
how the compiler generates code. As such, code that works correctly
(whether rightfully so or not) on any platform other than ia64, may
fail on ia64.

To more easily allow tweaking of the definition of NULL, this commit
removes the 12 definitions in the various headers and puts it in a
new header that can be included whenever NULL is to be made visible.

This commit fixes GNOME, emacs, xemacs and a whole bunch of ports
that I don't particularly care about at this time...


# 58d38e25 06-Sep-2002 Tim J. Robbins <tjr@FreeBSD.org>

Style: One space between "restrict" qualifier and "*".


# dd1b6791 02-Sep-2002 Mike Barcroft <mike@FreeBSD.org>

Now that _BSD_CLK_TCK_ and _BSD_CLOCKS_PER_SEC_ are the same on all
architectures, move the definition directly into <time.h> and finish
the removal of <machine/ansi.h>.


# abbd8902 21-Aug-2002 Mike Barcroft <mike@FreeBSD.org>

o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
macros, which are only MD because of gratuitous differences between
architectures.
o Change all headers to make use of this. This mainly involves
changing:
#ifdef _BSD_FOO_T_
typedef _BSD_FOO_T_ foo_t;
#undef _BSD_FOO_T_
#endif
to:
#ifndef _FOO_T_DECLARED
typedef __foo_t foo_t;
#define _FOO_T_DECLARED
#endif

Concept by: bde
Reviewed by: jake, obrien


# 620035ef 14-Aug-2002 Robert Drehmel <robert@FreeBSD.org>

- Add the 'restrict' qualifier to the function definition of
strftime(3) for IEEE Std 1003.1-2001 compliance and remove
excessive usage of the 'const' qualifier that was neither
present in the prototype in the publice header, nor in the
local prototype just above the function definition.
- Replace the K&R function definition with a ANSI-C one.
- Update the prototype of strftime(3) in its manual page.


# d542f511 14-Aug-2002 Robert Drehmel <robert@FreeBSD.org>

- Add the C99 'restrict' qualifier using the '__restrict' macro to
function prototype and definition of strptime(3).
- Update the manual page.


# b3ab54e1 27-Jun-2002 Garrett Wollman <wollman@FreeBSD.org>

The thread-safe time functions appear to have been introduced as of
ISO 9945-1: 1996 (according to the change bars therein), which corresponds
to 1003.1c-1995. Give them appropriate visibility protection.


# b8c54054 27-Jun-2002 Garrett Wollman <wollman@FreeBSD.org>

Resort namespace blocks into a more sensible order. Delete a redundant
comment.


# 8466ae90 16-Jun-2002 Garrett Wollman <wollman@FreeBSD.org>

Move dillon's time conversion functions to a new header <timeconv.h>.
Since they were never documented and have never appeared in a FreeBSD
release, no repo-copy of the header is done. This removes namespace
pollution from <time.h>.


# 73cf72f5 16-Jun-2002 Garrett Wollman <wollman@FreeBSD.org>

Clean up a bit of namespace pollution which crept in with the last rev.

Submitted by: bde


# 1cb2a9ae 15-Jun-2002 Garrett Wollman <wollman@FreeBSD.org>

Partially fix namespace visibility issues by using new visibility macros.
Some issues still remain, and will require research in old POSIX standards
if we care to get them right.


# bb28f3c2 23-Mar-2002 Warner Losh <imp@FreeBSD.org>

Breath deep and take __P out of the system include files.

# This appears to not break X11, but I'm having problems compiling the
# glide part of the server with or without this patch, so I can't tell
# for sure.


# 170ac683 19-Jan-2002 Matthew Dillon <dillon@FreeBSD.org>

I've been meaning to do this for a while. Add an underscore to the
time_to_xxx() and xxx_to_time() functions. e.g. _time_to_xxx()
instead of time_to_xxx(), to make it more obvious that these are
stopgap functions & placemarkers and not meant to create a defacto
standard. They will eventually be replaced when a real standard
comes out of committee.


# e8627df6 28-Oct-2001 Matthew Dillon <dillon@FreeBSD.org>

Add time_to_int(), int_to_time(), time_to_long(), long_to_time().


# 237c4e3a 28-Oct-2001 Matthew Dillon <dillon@FreeBSD.org>

Add routines to convert time_t to/from fixed-bit fields. These routines
serve two purposes: (1) so we can maintain backwards compatibility with
protocols (rwhod, dump, etc...) that either assume time_t is 32 bits or
assume sizeof(time_t) == sizeof(int), or make other similar assumptions.
(2) To tag such routines (by the presence of these calls) for future
cleanup/extension work.

The 32->64 routine, time32_to_time() (when time_t is 64 bits, that is),
is defined specifically to implement temporal locality to properly set the
msb bits of a 64 bit time_t quantity, using the 50 year rule. The locality
code has not been implemented yet (and doesn't need to be for a while),
but that is the intent. This will allow us to maintain backwards protocol
compatibility past 2038.

These routines are intended to be platform and time_t agnostic.

MFC after: 1 week


# 5b32a38a 31-Mar-2001 Poul-Henning Kamp <phk@FreeBSD.org>

It's not CUT (the french would accept that back in 1879) and TUC wasn't
palatable to the rest of the world. UTC was the compromise.

PR: 26238
Submitted by: Ying-Chieh Liao <ijliao@terry.dragon2.net>


# de160001 04-Jan-1999 Dmitrij Tejblum <dt@FreeBSD.org>

Make ctime_r, asctime_r, gmtime_r, and localtime_r available in libc.


# f0cefacc 12-Sep-1998 Dmitrij Tejblum <dt@FreeBSD.org>

Change return type of strptime from const char* to char*.
const char* was wrong and nonstandard.


# 2bd32397 20-Aug-1998 Joseph Koshy <jkoshy@FreeBSD.org>

Add extern declaration for `tzname[]' to make this header comply better
to POSIX90.

2-rounds-of-review-by: bde


# 3f643d87 19-Apr-1998 Poul-Henning Kamp <phk@FreeBSD.org>

ctime_r and asctime_r are not implemented.
prototypes in time.h do not match POSIX.

PR: 6345
Reviewed by: phk
Submitted by: Dmitry Khrustalev <dima@xyzzy.machaon.ru>


# 8a6472b7 28-Mar-1998 Peter Dufault <dufault@FreeBSD.org>

Finish _POSIX_PRIORITY_SCHEDULING. Needs P1003_1B and
_KPOSIX_PRIORITY_SCHEDULING options to work. Changes:

Change all "posix4" to "p1003_1b". Misnamed files are left
as "posix4" until I'm told if I can simply delete them and add
new ones;

Add _POSIX_PRIORITY_SCHEDULING system calls for FreeBSD and Linux;

Add man pages for _POSIX_PRIORITY_SCHEDULING system calls;

Add options to LINT;

Minor fixes to P1003_1B code during testing.


# 37486f03 09-Aug-1997 Joerg Wunsch <joerg@FreeBSD.org>

Import strptime(3) into libc. We've got permission by Kevin Ruddy to
modify the original `no modifications' copyright message, and i've
included his mail into the source file.

The common localization functions between strptime(3) and strftime(3)
have been broken out into timelocal.[ch].


# f154fbda 13-May-1997 Peter Wemm <peter@FreeBSD.org>

struct timespec needs to be useable with just <time.h>, but needs to not
conflict with the kernel visible one. Make the new stuff not visible if
_ANSI_SOURCE or _POSIX_SOURCE is defined (!) because the new things are
not part of the base 1003.1-1990 standard (or ansi).


# 9e0eb33e 13-May-1997 Andrey A. Chernov <ache@FreeBSD.org>

Add clockid_t definition like in sys/types.h to allow time.h
to be included without sys/types.h, it fixes broken groff compilation


# 2c97335b 11-May-1997 Peter Wemm <peter@FreeBSD.org>

Oops, move clock_*() and nanosleep() to time.h

Submitted by: Peter Dufault <dufault@hda.com>


# b0e998dc 11-Nov-1996 Jeffrey Hsu <hsu@FreeBSD.org>

Change prototypes for gmtime_r() and localtime_r() in accordance with
IEEE pthreads specification.


# f70177e7 21-Jan-1996 Julian Elischer <julian@FreeBSD.org>

Reviewed by: julian and (hsu?)
Submitted by: John Birrel(L?)

changes for threadsafe operations


# 02a7dd76 08-Feb-1995 Bruce Evans <bde@FreeBSD.org>

Define CLK_TCK right.


# 339b0f68 03-Feb-1995 Bruce Evans <bde@FreeBSD.org>

Define CLOCKS_PER_SEC.

Define CLK_TCK only if _ANSI_SOURCE is not defined.

Don't include <machine/limits.h> to get the definition of CLK_TCK.
CLK_TCK should never have been defined there, and the inclusion
polluted the namespace.


# 8c2f5ad7 26-Dec-1994 Andrey A. Chernov <ache@FreeBSD.org>

Declare useful functions (timelocal() and timegm())


# 59deaec5 24-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Include Sources