History log of /freebsd-current/lib/libc/stdtime/strftime.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 46c59934 13-Feb-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

Update tzcode to 2024a.

MFC after: 3 weeks
Sponsored by: Klara, Inc.


# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix

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

lib: 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

# 559a218c 01-Nov-2023 Warner Losh <imp@FreeBSD.org>

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42385

# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/

# bc421551 10-Jan-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

Bring our tzcode up to date.

* Replay 2010[acflm] which had been merged but not recorded.
* Merge 2010n.
* Reorganize (unsplit) the code to match the upstream layout.
* Merge 2022[cdefg].

MFC after: 1 week
Sponsored by: Klara, Inc.


# 5b5fa75a 04-Aug-2022 Ed Maste <emaste@FreeBSD.org>

libc: drop "All rights reserved" from Foundation copyrights

This has already been done for most files that have the Foundation as
the only listed copyright holder. Do it now for files that list
multiple copyright holders, but have the Foundation copyright in its own
section.

Sponsored by: The FreeBSD Foundation

# 85cef632 20-Sep-2015 Craig Rodrigues <rodrigc@FreeBSD.org>

Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.

# e66c50c7 26-Jul-2014 Pedro F. Giffuni <pfg@FreeBSD.org>

strftime() xlocale cleanups.

Replace fprintf_l with fputs when output is unformatted.
Use locale_t in _conv() since it was using sprintf (now sprintf_l)
Use locale_t on _yconv() sinci it calls _conv()

Obtained from: Apple Inc. (Libc 997.90.3)
CR: D482
Reviewed by: theraven
MFC after: 1 week

# 3624c752 17-Jun-2014 Pedro F. Giffuni <pfg@FreeBSD.org>

stdtime: style(9) fixes.

Obtained from: illumos
MFC after: 5 days

# 770284d8 17-Jun-2012 Jilles Tjoelker <jilles@FreeBSD.org>

libc: Reduce relative relocations in strftime().

# 3c87aa1d 20-Nov-2011 David Chisnall <theraven@FreeBSD.org>

Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a
load of _l suffixed versions of various standard library functions that use
the global locale, making them take an explicit locale parameter. Also
adds support for per-thread locales. This work was funded by the FreeBSD
Foundation.

Please test any code you have that uses the C standard locale functions!

Reviewed by: das (gdtoa changes)
Approved by: dim (mentor)

# dbfbdd04 09-Jun-2009 Xin LI <delphij@FreeBSD.org>

Spacing fixes. No actual change.

# dfc79e89 23-May-2009 Edwin Groothuis <edwin@FreeBSD.org>

MFV of tzcode2009e:

Upgrade of the tzcode from 2004a to 2009e.

Changes are numerous, but include...

- New format of the output of zic, which supports both 32 and 64
bit time_t formats.

- zdump on 64 bit platforms will actually produce some output instead
of doing nothing for a looooooooong time.

- linux_base-fX, with X >= at least 8, will work without problems related
to the local time again.

The original patch, based on the 2008e, has been running for a long
time on both my laptop and desktop machine and have been tested by
other people.

After the installation of this code and the running of zic(8), you
need to run tzsetup(8) again to install the new datafile.

Approved by: wollman@ for usr.sbin/zic
MFC after: 1 month

# 65443d59 29-Oct-2008 Xin LI <delphij@FreeBSD.org>

Pass a pointer to warn2 so the warn2 == IN_ALL would not be an
always-false condition.

# 5197bde3 27-Sep-2008 Edwin Groothuis <edwin@FreeBSD.org>

Flatten the dist tree of vendor/tzcode

# d9506686 04-Nov-2004 Xin LI <delphij@FreeBSD.org>

Add glibc-style strftime(3) padding specifiers, namely, -(no padding),
_(use space as padding), and 0(zero padding).

These GNU extensions are widely used ones that is worthy for us to
have.

Discussed with: stefanf, roam, -current
Approved by: murray
Prodded by: ports/72722, ports/72723
MFC After: 1 month

# cdff05fa 14-Jun-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Merge changes from the tzcode2004a import. Wherever possible I tried to bring
us closer to the vendor branch.

Requested by: wollman

# dcd1bc20 14-Jun-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Import tzcode2004a.

Obtained from: ftp://elsie.nci.nih.gov/pub/tzcode2004a.tar.gz

# d06ecced 13-Jun-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Remove a stale reference to %Ef and %EF from a comment.

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

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

# 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.

# 1d145de8 28-May-2002 Alfred Perlstein <alfred@FreeBSD.org>

Remove use of __P() (actually P()) from code now that it's no longer
available.

# 333fc21e 22-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.

# 58dae109 21-Mar-2001 Andrey A. Chernov <ache@FreeBSD.org>

Get rid of non-standard %E[Ff] formats, userland apps already fixed

# faeb1b82 18-Mar-2001 Andrey A. Chernov <ache@FreeBSD.org>

Relax local FreeBSD restrictions on 3 chars abbrev. name length and %c format
since they not allows POSIXly legal locale data. Currently, if relaxed form
POSIXly legal locale data will be used right now, some programs will be broken,
but it means that either locale data or programs must be fixed, not the library.

Introduce non-standard md_order (month/day order) locale field to be used later
via nl_langinfo(). Currently %EF and %Ef emulated using this field, but they
planned for remove in future in favour of nl_langinfo() test field.

Implement %F per POSIX

# 50bab1e6 02-Mar-2001 Andrey A. Chernov <ache@FreeBSD.org>

Implement ampm_fmt (%r) per POSIX

# d7422f2f 17-Feb-2001 Kris Kennaway <kris@FreeBSD.org>

Back out snprintf -> sprintf change until I have time to look at it.

# 740972dc 08-Feb-2001 Andrey A. Chernov <ache@FreeBSD.org>

Hardcode c_fmt in a different way since used in nl_langinfo now

# 930cd711 08-Feb-2001 Alexey Zelkin <phantom@FreeBSD.org>

Catch up to latest chanage in timelocal structures exporting.

# d201fe46 24-Jan-2001 Daniel Eischen <deischen@FreeBSD.org>

Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread
functions. If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
__sys_foo - actual system call
_foo - weak definition to __sys_foo
foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo. In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde). All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes. <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE. We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of <errno.h> from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by: -arch

# 4b5e6561 26-Nov-2000 Kris Kennaway <kris@FreeBSD.org>

sprintf -> snprintf

# f0b22c7b 26-Oct-2000 Andrey A. Chernov <ache@FreeBSD.org>

Force %c to be "%a %Ef %T %Y" to eliminate problems with bad c_fmt

Submitted by: ru

# 208b5822 28-Jan-2000 Joerg Wunsch <joerg@FreeBSD.org>

There were so far only 42 different conversion specifications in
strftime(3), add another one. :) %z yields the local timezone's offset
in hours and minutes, as used in RFC822 headers. There's a precedence
for this in Lunux' libc, and Internet software (like Perl scripts)
start using it.

OKed by (wrt. the code freeze): jkh

# c63a4303 30-Nov-1999 Andrey A. Chernov <ache@FreeBSD.org>

%Ex -> %Ef to not conflict with POSIX
Add %EF (long months name / day order)
Check that O and E not intermixed
Add missing POSIX extension to example

# 11cd0d32 30-Nov-1999 Andrey A. Chernov <ache@FreeBSD.org>

Add %Ex extension to determine "%e %b" or "%b %e" order
Separate alternative for O and E cases

# da3785ef 11-Sep-1999 Dmitrij Tejblum <dt@FreeBSD.org>

Implement new format specifier for strftime: %OB, alternative national
representation of the full month name. In the Russian locale, this alternative
will be "nominative case", useful when the date designate month as a whole.
E.g. month heading in a calendar. I hope it can be useful for some other
locales too.

Discussed with: wollman, ache

# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$

# c6966b0c 30-Jun-1998 Bruce Evans <bde@FreeBSD.org>

Fixed printf format errors. Don't assume so many things about time_t.

Obtained from: partial merge of ADO version tzcode96h (was fully merged
in 1.10 but backed out in 1.11; the FreeBSD code for %s
was earlier, prettier but buggier).

# b9b51fb7 03-Oct-1997 Wolfgang Helbig <helbig@FreeBSD.org>

Merged in better support of ISO 8601 from elsie.nci.nih.gov.
Added the conversion specifiers %g and %G, that are replaced
by the year which contains the greater part of the week in question.

# 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].

# 7e546392 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$

# b1950360 07-Feb-1997 Andrey A. Chernov <ache@FreeBSD.org>

Include "setlocale.h" for _PathLocale like other parts already did

Should go in 2.2

# e56a1af6 05-Feb-1997 Andrey A. Chernov <ache@FreeBSD.org>

Update the comment why range checking is not needed

Should go in 2.2

# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.

# af155bdf 27-Dec-1996 Andrey A. Chernov <ache@FreeBSD.org>

Add comment that range checking is already done at upper level
Kill snprintf left in collate.c from previous backout

Should go in 2.2

# 1a1379ae 25-Nov-1996 Andrey A. Chernov <ache@FreeBSD.org>

Move PATH_LOCALE handling to setlocale.c, simplify locale path building,
don't treat empty encoding as C encoding

# fe463a8f 19-Jul-1996 Garrett Wollman <wollman@FreeBSD.org>

Revert to old version of strftime.c; the new one doesn't work right.

# 1ecaa8a8 18-Jul-1996 Garrett Wollman <wollman@FreeBSD.org>

Merge the recently-imported tzcode96h distribution (libc portion). The
part that does zic(8)/zdump(8) is still yet to be imported (but the old
zic and zdump will work just fine with these header files and the
data format has not changed).

# 979a2116 18-Jul-1996 Garrett Wollman <wollman@FreeBSD.org>

Import the 96h release of ADO's timezone code. This release is
primarily bugfixes, but is also contains a disclaimer of copyright.
As we are completely off the vendor branch here, this import has
no effect on the source tree.

# 51295a4d 12-Jul-1996 Jordan K. Hubbard <jkh@FreeBSD.org>

General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>

# 6859875c 27-May-1996 Marc G. Fournier <scrappy@FreeBSD.org>

Removed false copyrights...

# b0d57629 26-May-1996 Marc G. Fournier <scrappy@FreeBSD.org>

Added in appropriate Berkeley copyright and RCS Id: string

Closes PR#doc/536

# 2d542a08 23-Oct-1995 Andrey A. Chernov <ache@FreeBSD.org>

Don't reset LC_TIME to C when it isn't neccessary

# 5ad178d8 07-Aug-1995 Andrey A. Chernov <ache@FreeBSD.org>

Restore %s format support from previous version

# d0e0d9c4 06-Aug-1995 Andrey A. Chernov <ache@FreeBSD.org>

Fix default %c to be ctime-compatible as supposed (by Solaris too)

# c28fbb7b 04-Aug-1995 Garrett Wollman <wollman@FreeBSD.org>

Implement locale-sensitive strftime () from ADO (heavily modified
by me). This probably loses for multibyte characters, but I have no
way of telling. I'll let ache decide whether to add this support to
startup_setlocale. Note that for this to make any sense at all, the
symlinks in /usr/share/locale must go. (For the moment, this doesn't
make any difference since there are no locales supplied.)

Obtained from: Arthur David Olson <ado@elsie.nci.nih.gov>

# be7f0d04 01-Mar-1995 Joerg Wunsch <joerg@FreeBSD.org>

On snap 950210, format %s (print seconds from the epoch) is missing
from the code in strftime.c . This affects both the library code
and all the commands using it (e.g. date +%s).

Note that %s is not required by ANSI, but we've already got it in 1.1.5.1.

Suggested by: luigi@labinfo.iet.unipi.it (Luigi Rizzo)

# 48d96b17 12-Sep-1994 Garrett Wollman <wollman@FreeBSD.org>

The rest of tzcode94g from Arthur David Olson.

Obtained From: Arthur David Olson, ftp://elsie.nci.nih.gov/pub/tzcode94g.tar.gz

# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


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

lib: 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


# 559a218c 01-Nov-2023 Warner Losh <imp@FreeBSD.org>

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42385


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# bc421551 10-Jan-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

Bring our tzcode up to date.

* Replay 2010[acflm] which had been merged but not recorded.
* Merge 2010n.
* Reorganize (unsplit) the code to match the upstream layout.
* Merge 2022[cdefg].

MFC after: 1 week
Sponsored by: Klara, Inc.


# 5b5fa75a 04-Aug-2022 Ed Maste <emaste@FreeBSD.org>

libc: drop "All rights reserved" from Foundation copyrights

This has already been done for most files that have the Foundation as
the only listed copyright holder. Do it now for files that list
multiple copyright holders, but have the Foundation copyright in its own
section.

Sponsored by: The FreeBSD Foundation

# 85cef632 20-Sep-2015 Craig Rodrigues <rodrigc@FreeBSD.org>

Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.

# e66c50c7 26-Jul-2014 Pedro F. Giffuni <pfg@FreeBSD.org>

strftime() xlocale cleanups.

Replace fprintf_l with fputs when output is unformatted.
Use locale_t in _conv() since it was using sprintf (now sprintf_l)
Use locale_t on _yconv() sinci it calls _conv()

Obtained from: Apple Inc. (Libc 997.90.3)
CR: D482
Reviewed by: theraven
MFC after: 1 week

# 3624c752 17-Jun-2014 Pedro F. Giffuni <pfg@FreeBSD.org>

stdtime: style(9) fixes.

Obtained from: illumos
MFC after: 5 days

# 770284d8 17-Jun-2012 Jilles Tjoelker <jilles@FreeBSD.org>

libc: Reduce relative relocations in strftime().

# 3c87aa1d 20-Nov-2011 David Chisnall <theraven@FreeBSD.org>

Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a
load of _l suffixed versions of various standard library functions that use
the global locale, making them take an explicit locale parameter. Also
adds support for per-thread locales. This work was funded by the FreeBSD
Foundation.

Please test any code you have that uses the C standard locale functions!

Reviewed by: das (gdtoa changes)
Approved by: dim (mentor)

# dbfbdd04 09-Jun-2009 Xin LI <delphij@FreeBSD.org>

Spacing fixes. No actual change.

# dfc79e89 23-May-2009 Edwin Groothuis <edwin@FreeBSD.org>

MFV of tzcode2009e:

Upgrade of the tzcode from 2004a to 2009e.

Changes are numerous, but include...

- New format of the output of zic, which supports both 32 and 64
bit time_t formats.

- zdump on 64 bit platforms will actually produce some output instead
of doing nothing for a looooooooong time.

- linux_base-fX, with X >= at least 8, will work without problems related
to the local time again.

The original patch, based on the 2008e, has been running for a long
time on both my laptop and desktop machine and have been tested by
other people.

After the installation of this code and the running of zic(8), you
need to run tzsetup(8) again to install the new datafile.

Approved by: wollman@ for usr.sbin/zic
MFC after: 1 month

# 65443d59 29-Oct-2008 Xin LI <delphij@FreeBSD.org>

Pass a pointer to warn2 so the warn2 == IN_ALL would not be an
always-false condition.

# 5197bde3 27-Sep-2008 Edwin Groothuis <edwin@FreeBSD.org>

Flatten the dist tree of vendor/tzcode

# d9506686 04-Nov-2004 Xin LI <delphij@FreeBSD.org>

Add glibc-style strftime(3) padding specifiers, namely, -(no padding),
_(use space as padding), and 0(zero padding).

These GNU extensions are widely used ones that is worthy for us to
have.

Discussed with: stefanf, roam, -current
Approved by: murray
Prodded by: ports/72722, ports/72723
MFC After: 1 month

# cdff05fa 14-Jun-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Merge changes from the tzcode2004a import. Wherever possible I tried to bring
us closer to the vendor branch.

Requested by: wollman

# dcd1bc20 14-Jun-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Import tzcode2004a.

Obtained from: ftp://elsie.nci.nih.gov/pub/tzcode2004a.tar.gz

# d06ecced 13-Jun-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Remove a stale reference to %Ef and %EF from a comment.

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

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

# 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.

# 1d145de8 28-May-2002 Alfred Perlstein <alfred@FreeBSD.org>

Remove use of __P() (actually P()) from code now that it's no longer
available.

# 333fc21e 22-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.

# 58dae109 21-Mar-2001 Andrey A. Chernov <ache@FreeBSD.org>

Get rid of non-standard %E[Ff] formats, userland apps already fixed

# faeb1b82 18-Mar-2001 Andrey A. Chernov <ache@FreeBSD.org>

Relax local FreeBSD restrictions on 3 chars abbrev. name length and %c format
since they not allows POSIXly legal locale data. Currently, if relaxed form
POSIXly legal locale data will be used right now, some programs will be broken,
but it means that either locale data or programs must be fixed, not the library.

Introduce non-standard md_order (month/day order) locale field to be used later
via nl_langinfo(). Currently %EF and %Ef emulated using this field, but they
planned for remove in future in favour of nl_langinfo() test field.

Implement %F per POSIX

# 50bab1e6 02-Mar-2001 Andrey A. Chernov <ache@FreeBSD.org>

Implement ampm_fmt (%r) per POSIX

# d7422f2f 17-Feb-2001 Kris Kennaway <kris@FreeBSD.org>

Back out snprintf -> sprintf change until I have time to look at it.

# 740972dc 08-Feb-2001 Andrey A. Chernov <ache@FreeBSD.org>

Hardcode c_fmt in a different way since used in nl_langinfo now

# 930cd711 08-Feb-2001 Alexey Zelkin <phantom@FreeBSD.org>

Catch up to latest chanage in timelocal structures exporting.

# d201fe46 24-Jan-2001 Daniel Eischen <deischen@FreeBSD.org>

Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread
functions. If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
__sys_foo - actual system call
_foo - weak definition to __sys_foo
foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo. In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde). All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes. <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE. We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of <errno.h> from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by: -arch

# 4b5e6561 26-Nov-2000 Kris Kennaway <kris@FreeBSD.org>

sprintf -> snprintf

# f0b22c7b 26-Oct-2000 Andrey A. Chernov <ache@FreeBSD.org>

Force %c to be "%a %Ef %T %Y" to eliminate problems with bad c_fmt

Submitted by: ru

# 208b5822 28-Jan-2000 Joerg Wunsch <joerg@FreeBSD.org>

There were so far only 42 different conversion specifications in
strftime(3), add another one. :) %z yields the local timezone's offset
in hours and minutes, as used in RFC822 headers. There's a precedence
for this in Lunux' libc, and Internet software (like Perl scripts)
start using it.

OKed by (wrt. the code freeze): jkh

# c63a4303 30-Nov-1999 Andrey A. Chernov <ache@FreeBSD.org>

%Ex -> %Ef to not conflict with POSIX
Add %EF (long months name / day order)
Check that O and E not intermixed
Add missing POSIX extension to example

# 11cd0d32 30-Nov-1999 Andrey A. Chernov <ache@FreeBSD.org>

Add %Ex extension to determine "%e %b" or "%b %e" order
Separate alternative for O and E cases

# da3785ef 11-Sep-1999 Dmitrij Tejblum <dt@FreeBSD.org>

Implement new format specifier for strftime: %OB, alternative national
representation of the full month name. In the Russian locale, this alternative
will be "nominative case", useful when the date designate month as a whole.
E.g. month heading in a calendar. I hope it can be useful for some other
locales too.

Discussed with: wollman, ache

# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$

# c6966b0c 30-Jun-1998 Bruce Evans <bde@FreeBSD.org>

Fixed printf format errors. Don't assume so many things about time_t.

Obtained from: partial merge of ADO version tzcode96h (was fully merged
in 1.10 but backed out in 1.11; the FreeBSD code for %s
was earlier, prettier but buggier).

# b9b51fb7 03-Oct-1997 Wolfgang Helbig <helbig@FreeBSD.org>

Merged in better support of ISO 8601 from elsie.nci.nih.gov.
Added the conversion specifiers %g and %G, that are replaced
by the year which contains the greater part of the week in question.

# 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].

# 7e546392 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$

# b1950360 07-Feb-1997 Andrey A. Chernov <ache@FreeBSD.org>

Include "setlocale.h" for _PathLocale like other parts already did

Should go in 2.2

# e56a1af6 05-Feb-1997 Andrey A. Chernov <ache@FreeBSD.org>

Update the comment why range checking is not needed

Should go in 2.2

# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.

# af155bdf 27-Dec-1996 Andrey A. Chernov <ache@FreeBSD.org>

Add comment that range checking is already done at upper level
Kill snprintf left in collate.c from previous backout

Should go in 2.2

# 1a1379ae 25-Nov-1996 Andrey A. Chernov <ache@FreeBSD.org>

Move PATH_LOCALE handling to setlocale.c, simplify locale path building,
don't treat empty encoding as C encoding

# fe463a8f 19-Jul-1996 Garrett Wollman <wollman@FreeBSD.org>

Revert to old version of strftime.c; the new one doesn't work right.

# 1ecaa8a8 18-Jul-1996 Garrett Wollman <wollman@FreeBSD.org>

Merge the recently-imported tzcode96h distribution (libc portion). The
part that does zic(8)/zdump(8) is still yet to be imported (but the old
zic and zdump will work just fine with these header files and the
data format has not changed).

# 979a2116 18-Jul-1996 Garrett Wollman <wollman@FreeBSD.org>

Import the 96h release of ADO's timezone code. This release is
primarily bugfixes, but is also contains a disclaimer of copyright.
As we are completely off the vendor branch here, this import has
no effect on the source tree.

# 51295a4d 12-Jul-1996 Jordan K. Hubbard <jkh@FreeBSD.org>

General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>

# 6859875c 27-May-1996 Marc G. Fournier <scrappy@FreeBSD.org>

Removed false copyrights...

# b0d57629 26-May-1996 Marc G. Fournier <scrappy@FreeBSD.org>

Added in appropriate Berkeley copyright and RCS Id: string

Closes PR#doc/536

# 2d542a08 23-Oct-1995 Andrey A. Chernov <ache@FreeBSD.org>

Don't reset LC_TIME to C when it isn't neccessary

# 5ad178d8 07-Aug-1995 Andrey A. Chernov <ache@FreeBSD.org>

Restore %s format support from previous version

# d0e0d9c4 06-Aug-1995 Andrey A. Chernov <ache@FreeBSD.org>

Fix default %c to be ctime-compatible as supposed (by Solaris too)

# c28fbb7b 04-Aug-1995 Garrett Wollman <wollman@FreeBSD.org>

Implement locale-sensitive strftime () from ADO (heavily modified
by me). This probably loses for multibyte characters, but I have no
way of telling. I'll let ache decide whether to add this support to
startup_setlocale. Note that for this to make any sense at all, the
symlinks in /usr/share/locale must go. (For the moment, this doesn't
make any difference since there are no locales supplied.)

Obtained from: Arthur David Olson <ado@elsie.nci.nih.gov>

# be7f0d04 01-Mar-1995 Joerg Wunsch <joerg@FreeBSD.org>

On snap 950210, format %s (print seconds from the epoch) is missing
from the code in strftime.c . This affects both the library code
and all the commands using it (e.g. date +%s).

Note that %s is not required by ANSI, but we've already got it in 1.1.5.1.

Suggested by: luigi@labinfo.iet.unipi.it (Luigi Rizzo)

# 48d96b17 12-Sep-1994 Garrett Wollman <wollman@FreeBSD.org>

The rest of tzcode94g from Arthur David Olson.

Obtained From: Arthur David Olson, ftp://elsie.nci.nih.gov/pub/tzcode94g.tar.gz

# 5b5fa75a 04-Aug-2022 Ed Maste <emaste@FreeBSD.org>

libc: drop "All rights reserved" from Foundation copyrights

This has already been done for most files that have the Foundation as
the only listed copyright holder. Do it now for files that list
multiple copyright holders, but have the Foundation copyright in its own
section.

Sponsored by: The FreeBSD Foundation


# 85cef632 20-Sep-2015 Craig Rodrigues <rodrigc@FreeBSD.org>

Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.


# e66c50c7 26-Jul-2014 Pedro F. Giffuni <pfg@FreeBSD.org>

strftime() xlocale cleanups.

Replace fprintf_l with fputs when output is unformatted.
Use locale_t in _conv() since it was using sprintf (now sprintf_l)
Use locale_t on _yconv() sinci it calls _conv()

Obtained from: Apple Inc. (Libc 997.90.3)
CR: D482
Reviewed by: theraven
MFC after: 1 week


# 3624c752 17-Jun-2014 Pedro F. Giffuni <pfg@FreeBSD.org>

stdtime: style(9) fixes.

Obtained from: illumos
MFC after: 5 days


# 770284d8 17-Jun-2012 Jilles Tjoelker <jilles@FreeBSD.org>

libc: Reduce relative relocations in strftime().


# 3c87aa1d 20-Nov-2011 David Chisnall <theraven@FreeBSD.org>

Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a
load of _l suffixed versions of various standard library functions that use
the global locale, making them take an explicit locale parameter. Also
adds support for per-thread locales. This work was funded by the FreeBSD
Foundation.

Please test any code you have that uses the C standard locale functions!

Reviewed by: das (gdtoa changes)
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.


# dbfbdd04 09-Jun-2009 Xin LI <delphij@FreeBSD.org>

Spacing fixes. No actual change.


# dfc79e89 23-May-2009 Edwin Groothuis <edwin@FreeBSD.org>

MFV of tzcode2009e:

Upgrade of the tzcode from 2004a to 2009e.

Changes are numerous, but include...

- New format of the output of zic, which supports both 32 and 64
bit time_t formats.

- zdump on 64 bit platforms will actually produce some output instead
of doing nothing for a looooooooong time.

- linux_base-fX, with X >= at least 8, will work without problems related
to the local time again.

The original patch, based on the 2008e, has been running for a long
time on both my laptop and desktop machine and have been tested by
other people.

After the installation of this code and the running of zic(8), you
need to run tzsetup(8) again to install the new datafile.

Approved by: wollman@ for usr.sbin/zic
MFC after: 1 month


# 65443d59 29-Oct-2008 Xin LI <delphij@FreeBSD.org>

Pass a pointer to warn2 so the warn2 == IN_ALL would not be an
always-false condition.


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

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


# d9506686 04-Nov-2004 Xin LI <delphij@FreeBSD.org>

Add glibc-style strftime(3) padding specifiers, namely, -(no padding),
_(use space as padding), and 0(zero padding).

These GNU extensions are widely used ones that is worthy for us to
have.

Discussed with: stefanf, roam, -current
Approved by: murray
Prodded by: ports/72722, ports/72723
MFC After: 1 month


# cdff05fa 14-Jun-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Merge changes from the tzcode2004a import. Wherever possible I tried to bring
us closer to the vendor branch.

Requested by: wollman


# dcd1bc20 14-Jun-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Import tzcode2004a.

Obtained from: ftp://elsie.nci.nih.gov/pub/tzcode2004a.tar.gz


# d06ecced 13-Jun-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Remove a stale reference to %Ef and %EF from a comment.


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

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


# 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.


# 1d145de8 28-May-2002 Alfred Perlstein <alfred@FreeBSD.org>

Remove use of __P() (actually P()) from code now that it's no longer
available.


# 333fc21e 22-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.


# 58dae109 21-Mar-2001 Andrey A. Chernov <ache@FreeBSD.org>

Get rid of non-standard %E[Ff] formats, userland apps already fixed


# faeb1b82 18-Mar-2001 Andrey A. Chernov <ache@FreeBSD.org>

Relax local FreeBSD restrictions on 3 chars abbrev. name length and %c format
since they not allows POSIXly legal locale data. Currently, if relaxed form
POSIXly legal locale data will be used right now, some programs will be broken,
but it means that either locale data or programs must be fixed, not the library.

Introduce non-standard md_order (month/day order) locale field to be used later
via nl_langinfo(). Currently %EF and %Ef emulated using this field, but they
planned for remove in future in favour of nl_langinfo() test field.

Implement %F per POSIX


# 50bab1e6 02-Mar-2001 Andrey A. Chernov <ache@FreeBSD.org>

Implement ampm_fmt (%r) per POSIX


# d7422f2f 17-Feb-2001 Kris Kennaway <kris@FreeBSD.org>

Back out snprintf -> sprintf change until I have time to look at it.


# 740972dc 08-Feb-2001 Andrey A. Chernov <ache@FreeBSD.org>

Hardcode c_fmt in a different way since used in nl_langinfo now


# 930cd711 08-Feb-2001 Alexey Zelkin <phantom@FreeBSD.org>

Catch up to latest chanage in timelocal structures exporting.


# d201fe46 24-Jan-2001 Daniel Eischen <deischen@FreeBSD.org>

Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread
functions. If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
__sys_foo - actual system call
_foo - weak definition to __sys_foo
foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo. In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde). All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes. <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE. We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of <errno.h> from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by: -arch


# 4b5e6561 26-Nov-2000 Kris Kennaway <kris@FreeBSD.org>

sprintf -> snprintf


# f0b22c7b 26-Oct-2000 Andrey A. Chernov <ache@FreeBSD.org>

Force %c to be "%a %Ef %T %Y" to eliminate problems with bad c_fmt

Submitted by: ru


# 208b5822 28-Jan-2000 Joerg Wunsch <joerg@FreeBSD.org>

There were so far only 42 different conversion specifications in
strftime(3), add another one. :) %z yields the local timezone's offset
in hours and minutes, as used in RFC822 headers. There's a precedence
for this in Lunux' libc, and Internet software (like Perl scripts)
start using it.

OKed by (wrt. the code freeze): jkh


# c63a4303 30-Nov-1999 Andrey A. Chernov <ache@FreeBSD.org>

%Ex -> %Ef to not conflict with POSIX
Add %EF (long months name / day order)
Check that O and E not intermixed
Add missing POSIX extension to example


# 11cd0d32 30-Nov-1999 Andrey A. Chernov <ache@FreeBSD.org>

Add %Ex extension to determine "%e %b" or "%b %e" order
Separate alternative for O and E cases


# da3785ef 11-Sep-1999 Dmitrij Tejblum <dt@FreeBSD.org>

Implement new format specifier for strftime: %OB, alternative national
representation of the full month name. In the Russian locale, this alternative
will be "nominative case", useful when the date designate month as a whole.
E.g. month heading in a calendar. I hope it can be useful for some other
locales too.

Discussed with: wollman, ache


# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# c6966b0c 30-Jun-1998 Bruce Evans <bde@FreeBSD.org>

Fixed printf format errors. Don't assume so many things about time_t.

Obtained from: partial merge of ADO version tzcode96h (was fully merged
in 1.10 but backed out in 1.11; the FreeBSD code for %s
was earlier, prettier but buggier).


# b9b51fb7 03-Oct-1997 Wolfgang Helbig <helbig@FreeBSD.org>

Merged in better support of ISO 8601 from elsie.nci.nih.gov.
Added the conversion specifiers %g and %G, that are replaced
by the year which contains the greater part of the week in question.


# 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].


# 7e546392 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# b1950360 07-Feb-1997 Andrey A. Chernov <ache@FreeBSD.org>

Include "setlocale.h" for _PathLocale like other parts already did

Should go in 2.2


# e56a1af6 05-Feb-1997 Andrey A. Chernov <ache@FreeBSD.org>

Update the comment why range checking is not needed

Should go in 2.2


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# af155bdf 27-Dec-1996 Andrey A. Chernov <ache@FreeBSD.org>

Add comment that range checking is already done at upper level
Kill snprintf left in collate.c from previous backout

Should go in 2.2


# 1a1379ae 25-Nov-1996 Andrey A. Chernov <ache@FreeBSD.org>

Move PATH_LOCALE handling to setlocale.c, simplify locale path building,
don't treat empty encoding as C encoding


# fe463a8f 19-Jul-1996 Garrett Wollman <wollman@FreeBSD.org>

Revert to old version of strftime.c; the new one doesn't work right.


# 1ecaa8a8 18-Jul-1996 Garrett Wollman <wollman@FreeBSD.org>

Merge the recently-imported tzcode96h distribution (libc portion). The
part that does zic(8)/zdump(8) is still yet to be imported (but the old
zic and zdump will work just fine with these header files and the
data format has not changed).


# 979a2116 18-Jul-1996 Garrett Wollman <wollman@FreeBSD.org>

Import the 96h release of ADO's timezone code. This release is
primarily bugfixes, but is also contains a disclaimer of copyright.
As we are completely off the vendor branch here, this import has
no effect on the source tree.


# 51295a4d 12-Jul-1996 Jordan K. Hubbard <jkh@FreeBSD.org>

General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>


# 6859875c 27-May-1996 Marc G. Fournier <scrappy@FreeBSD.org>

Removed false copyrights...


# b0d57629 26-May-1996 Marc G. Fournier <scrappy@FreeBSD.org>

Added in appropriate Berkeley copyright and RCS Id: string

Closes PR#doc/536


# 2d542a08 23-Oct-1995 Andrey A. Chernov <ache@FreeBSD.org>

Don't reset LC_TIME to C when it isn't neccessary


# 5ad178d8 07-Aug-1995 Andrey A. Chernov <ache@FreeBSD.org>

Restore %s format support from previous version


# d0e0d9c4 06-Aug-1995 Andrey A. Chernov <ache@FreeBSD.org>

Fix default %c to be ctime-compatible as supposed (by Solaris too)


# c28fbb7b 04-Aug-1995 Garrett Wollman <wollman@FreeBSD.org>

Implement locale-sensitive strftime () from ADO (heavily modified
by me). This probably loses for multibyte characters, but I have no
way of telling. I'll let ache decide whether to add this support to
startup_setlocale. Note that for this to make any sense at all, the
symlinks in /usr/share/locale must go. (For the moment, this doesn't
make any difference since there are no locales supplied.)

Obtained from: Arthur David Olson <ado@elsie.nci.nih.gov>


# be7f0d04 01-Mar-1995 Joerg Wunsch <joerg@FreeBSD.org>

On snap 950210, format %s (print seconds from the epoch) is missing
from the code in strftime.c . This affects both the library code
and all the commands using it (e.g. date +%s).

Note that %s is not required by ANSI, but we've already got it in 1.1.5.1.

Suggested by: luigi@labinfo.iet.unipi.it (Luigi Rizzo)


# 48d96b17 12-Sep-1994 Garrett Wollman <wollman@FreeBSD.org>

The rest of tzcode94g from Arthur David Olson.

Obtained From: Arthur David Olson, ftp://elsie.nci.nih.gov/pub/tzcode94g.tar.gz