Home | History | Annotate | Download | only in time
History log of /src/lib/libc/time/strftime.3
RevisionDateAuthorComments
 1.41  08-Apr-2025  riastradh strftime(3): Nix more trailing whitespace.

Missed a spot due to cvs update cycle.

PR lib/59249: missing man pages: strptime_l, strftime_l, strftime_lz,
strftime_z
 1.40  08-Apr-2025  riastradh strftime(3): Nix trailing whitespace.

PR lib/59249: missing man pages: strptime_l, strftime_l, strftime_lz,
strftime_z
 1.39  06-Apr-2025  christos PR/59249: Taylor R Campbell: Add missing man pages: strptime_l, strftime_l,
strftime_lz, strftime_z
 1.38  23-Jan-2025  christos update to 2025a

Changes to code

strftime %s now generates the correct numeric string even when the
represented number does not fit into time_t. This is better than
generating the numeric equivalent of (time_t) -1, as strftime did
in TZDB releases 96a (when %s was introduced) through 2020a and in
releases 2022b through 2024b. It is also better than failing and
returning 0, as strftime did in releases 2020b through 2022a.

strftime now outputs an invalid conversion specifier as-is,
instead of eliding the leading '%', which confused debugging.

An invalid TZ now generates the time zone abbreviation "-00", not
"UTC", to help the user see that an error has occurred. (Thanks
to Arthur David Olson for suggesting a "wrong result".)

mktime and timeoff no longer incorrectly fail merely because a
struct tm component near INT_MIN or INT_MAX overflows when a
lower-order component carries into it.

TZNAME_MAXIMUM, the maximum number of bytes in a proleptic TZ
string's time zone abbreviation, now defaults to 254 not 255.
This helps reduce the size of internal state from 25480 to 21384
on common platforms. This change should not be a problem, as
nobody uses such long "abbreviations" and the longstanding tzcode
maximum was 16 until release 2023a. For those who prefer no
arbitrary limits, you can now specify TZNAME_MAXIMUM values up to
PTRDIFF_MAX, a limit forced by C anyway; formerly tzcode silently
misbehaved unless TZNAME_MAXIMUM was less than INT_MAX.

tzset and related functions no longer leak a file descriptor if
another thread forks or execs at about the same time and if the
platform has O_CLOFORK and O_CLOEXEC respectively. Also, the
functions no longer let a TZif file become a controlling terminal.

'zdump -' now reads TZif data from /dev/stdin.
(From a question by Arthur David Olson.)
 1.37  25-Oct-2022  kre branches: 1.37.4;

Fix a merge or conversion problem (probably) - a .SH BUGS
(meaningless macro in mdoc) followed by the first line of the
real BUGS section somehow ended up inserted after the first
word of the STANDARDS section. Delete the noise.
 1.36  09-Oct-2020  christos Merge tzcode2020b (except we keep tzsetwall(3) for now for compatibility,
and we were "slim" already)

Support for zic's long-obsolete '-y YEARISTYPE' option has been
removed and, with it, so has support for the TYPE field in Rule
lines, which is now reserved for compatibility with earlier zic.
These features were previously deprecated in release 2015f.
(Thanks to Tim Parenti.)

zic now defaults to '-b slim' instead of to '-b fat'.

zic's new '-l -' and '-p -' options uninstall any existing
localtime and posixrules files, respectively.

The undocumented and ineffective tzsetwall function has been
removed.
 1.35  05-Apr-2019  christos - Padding support from FreeBSD (GNU extensions)
- add '+' for the c-locale only.
 1.34  19-Oct-2018  christos Update to 2018f:

Changes to code

zic now always generates TZif files where time type 0 is used for
timestamps before the first transition. This simplifies the
reading of TZif files and should not affect behavior of existing
TZif readers because the same set of time types is used; only
their internal indexes may have changed. This affects only the
legacy zones EST5EDT, CST6CDT, MST7MDT, PST8PDT, CET, MET, and
EET, which previously used nonzero types for these timestamps.

Because of the type 0 change, zic no longer outputs a dummy
transition at time -2**59 (before the Big Bang), as clients should
no longer need this to handle historical timestamps correctly.
This reverts a change introduced in 2013d and shrinks most TZif
files by a few bytes.

zic now supports negative time-of-day in Rule and Leap lines, e.g.,
"Rule X min max - Apr lastSun -6:00 1:00 -" means the transition
occurs at 18:00 on the Saturday before the last Sunday in April.
This behavior was documented in 2018a but the code did not
entirely match the documentation.

localtime.c no longer requires at least one time type in TZif
files that lack transitions or have a POSIX-style TZ string. This
future-proofs the code against possible future extensions to the
format that would allow TZif files with POSIX-style TZ strings and
without transitions or time types.

A read-access subscript error in localtime.c has been fixed.
It could occur only in TZif files with timecnt == 0, something that
does not happen in practice now but could happen in future versions.

localtime.c no longer ignores TZif POSIX-style TZ strings that
specify only standard time. Instead, these TZ strings now
override the default time type for timestamps after the last
transition (or for all time stamps if there are no transitions),
just as DST strings specifying DST have always done.

leapseconds.awk now outputs "#updated" and "#expires" comments,
and supports leap seconds at the ends of months other than June
and December. (Inspired by suggestions from Chris Woodbury.)

Changes to documentation

New restrictions: A Rule name must start with a character that
is neither an ASCII digit nor "-" nor "+", and an unquoted name
should not use characters in the set "!$%&'()*,/:;<=>?@[\]^`{|}~".
The latter restriction makes room for future extensions (a
possibility noted by Tom Lane).

tzfile.5 now documents what time types apply before the first and
after the last transition, if any.

Documentation now uses the spelling "timezone" for a TZ setting
that determines timestamp history, and "time zone" for a
geographic region currently sharing the same standard time.

The name "TZif" is now used for the tz binary data format.

tz-link.htm now mentions the A0 TimeZone Migration utilities.
(Thanks to Aldrin Martoq for the link.)
 1.33  11-Mar-2017  christos branches: 1.33.10; 1.33.12;
merge 2017a
 1.32  24-Dec-2016  abhinav branches: 1.32.2;
As per C99 the range of values for the %S format specifier is [0,60]
rather than [0,61]. The standard has removed mention of double leap seconds.
The standard has give the following rationale in the time.h man page:

"The range [0,60] seconds allows for positive or negative leap seconds.
The formal definition of UTC does not permit double leap seconds, so all
mention of double leap seconds has been removed, and the range shortened
from the former [0,61] seconds seen in previous versions of POSIX."
 1.31  22-Sep-2016  pgoyette Since the argument buf is earlier described as a buffer, replace all
references to "the array" with "the buffer" for consistency.

Bump date.
 1.30  20-Sep-2013  christos branches: 1.30.8;
Welcome to tzcode 2013e:

Changes affecting API

The 'zic' command now outputs a dummy transition when far-future
data can't be summarized using a TZ string, and uses a 402-year
window rather than a 400-year window. For the current data, this
affects only the Asia/Tehran file. It does not affect any of the
time stamps that this file represents, so zdump outputs the same
information as before. (Thanks to Andrew Main (Zefram).)

The 'date' command has a new '-r' option, which lets you specify
the integer time to display, a la FreeBSD.

The 'tzselect' command has two new options '-c' and '-n', which lets you
select a zone based on latitude and longitude.

The 'zic' command's '-v' option now warns about constructs that
require the new version-3 binary file format. (Thanks to Arthur
David Olson for the suggestion.)

Support for floating-point time_t has been removed.
It was always dicey, and POSIX no longer requires it.
(Thanks to Eric Blake for suggesting to the POSIX committee to
remove it, and thanks to Alan Barrett, Clive D.W. Feather, Andy
Heninger, Arthur David Olson, and Alois Treindl, for reporting
bugs and elucidating some of the corners of the old floating-point
implementation.)

The signatures of 'offtime', 'timeoff', and 'gtime' have been
changed back to the old practice of using 'long' to represent UT
offsets. This had been inadvertently and mistakenly changed to
'int_fast32_t'. (Thanks to Christos Zoulos.)

The code avoids undefined behavior on integer overflow in some
more places, including gmtime, localtime, mktime and zdump.

Changes affecting the zdump utility

zdump now outputs "UT" when referring to Universal Time, not "UTC".
"UTC" does not make sense for time stamps that predate the introduction
of UTC, whereas "UT", a more-generic term, does. (Thanks to Steve Allen
for clarifying UT vs UTC.)

Data changes affecting behavior of tzselect and similar programs

Country code BQ is now called the more-common name "Caribbean Netherlands"
rather than the more-official "Bonaire, St Eustatius & Saba".

Remove from zone.tab the names America/Montreal, America/Shiprock,
and Antarctica/South_Pole, as they are equivalent to existing
same-country-code zones for post-1970 time stamps. The data for
these names are unchanged, so the names continue to work as before.

Changes affecting code internals

zic -c now runs way faster on 64-bit hosts when given large numbers.

zic now uses vfprintf to avoid allocating and freeing some memory.

tzselect now computes the list of continents from the data,
rather than have it hard-coded.

Minor changes pacify GCC 4.7.3 and GCC 4.8.1.

Changes affecting the build procedure

The 'leapseconds' file is now generated automatically from a
new file 'leap-seconds.list', which is a copy of
<ftp://time.nist.gov/pub/leap-seconds.list>.
A new source file 'leapseconds.awk' implements this.
The goal is simplification of the future maintenance of 'leapseconds'.

When building the 'posix' or 'right' subdirectories, if the
subdirectory would be a copy of the default subdirectory, it is
now made a symbolic link if that is supported. This saves about
2 MB of file system space.

The links America/Shiprock and Antarctica/South_Pole have been
moved to the 'backward' file. This affects only nondefault builds
that omit 'backward'.

Changes affecting documentation and commentary

Changes to the 'tzfile' man page

It now mentions that the binary file format may be extended in
future versions by appending data.

It now refers to the 'zdump' and 'zic' man pages.

Changes to the 'zic' man page

It lists conditions that elicit a warning with '-v'.

It says that the behavior is unspecified when duplicate names
are given, or if the source of one link is the target of another.

Its examples are updated to match the latest data.

The definition of white space has been clarified slightly.
(Thanks to Michael Deckers.)

Changes to the 'Theory' file

There is a new section about the accuracy of the tz database,
describing the many ways that errors can creep in, and
explaining why so many of the pre-1970 time stamps are wrong or
misleading (thanks to Steve Allen, Lester Caine, and Garrett
Wollman for discussions that contributed to this).

The 'Theory' file describes LMT better (this follows a
suggestion by Guy Harris).

It refers to the 2013 edition of POSIX rather than the 2004 edition.

It's mentioned that excluding 'backward' should not affect the
other data, and it suggests at least one zone.tab name per
inhabited country (thanks to Stephen Colebourne).

Some longstanding restrictions on names are documented, e.g.,
'America/New_York' precludes 'America/New_York/Bronx'.

It gives more reasons for the 1970 cutoff.

It now mentions which time_t variants are supported, such as
signed integer time_t. (Thanks to Paul Goyette for reporting
typos in an experimental version of this change.)

(Thanks to Philip Newton for correcting typos in these changes.)

Documentation and commentary is more careful to distinguish UT in
general from UTC in particular. (Thanks to Steve Allen.)

Add a better source for the Zurich 1894 transition.
(Thanks to Pierre-Yves Berger.)

Update shapefile citations in tz-link.htm. (Thanks to Guy Harris.)
 1.29  06-Apr-2012  wiz branches: 1.29.2;
Fix typo, from Bug Hunting.
 1.28  14-Apr-2011  jruoho branches: 1.28.4;
Xref tm(3).
 1.27  16-Dec-2010  christos Provide a re-entrant and thread-safe set of timezone API's that
don't require locking and can operate on user-specified timezones
as opposed to having to alter the environment to change a timezone.
This work was presented to the tzcode folks and it was generally
accepted, but there seems to be a lot of inertia.
 1.26  29-May-2010  dholland Note briefly how to avoid the problem where 0 can be a valid successful
return as well as an error. Suggested by Robert Elz in follow up to PR 39392.
 1.25  29-Apr-2010  jruoho Note the ambiguity of the return value in the BUGS section.

From Christian Biere <christianbiere@gmx.de> in PR #39392.
 1.24  11-Apr-2009  joerg Fix markup.
 1.23  17-Jun-2006  reed branches: 1.23.30;
Fix typo or mispelling.
 1.22  14-Apr-2004  kleink Add documentation for %v. Noted by Havard Eidnes in PR bin/25180.
 1.21  08-Sep-2003  wiz branches: 1.21.2;
Use St -isoC-9X instead of St -isoC9X, to be in sync with groff.
 1.20  03-Sep-2003  jhawk %F is a date conversion, not a time converstion.
don't bother to bump Dd
 1.19  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.18  16-Apr-2003  wiz Use
.In header.h
instead of
.Fd #include \*[Lt]header.h\*[Gt]
Much easier to read and write, and supported by groff for ages.
Okayed by ross.
 1.17  10-Nov-2002  kleink Fix typo UCT -> UTC; from Christian Biere in PR lib/19007.
 1.16  01-Oct-2002  wiz New sentence, new line. From Robert Elz.
 1.15  18-Aug-2002  yamt note that the contents of the array are undefined in the error case.
 1.14  18-Aug-2002  yamt - Mention leap seconds as the reason for (00-61)
- include blurb about ISO 8601 dates straight from strftime.c
from OpenBSD.
 1.13  07-Feb-2002  ross branches: 1.13.2;
Generate <>& symbolically.
 1.12  13-Dec-2001  kleink Document %z.
 1.11  10-Dec-2001  kleink Sort conversion specifiers.
 1.10  16-Sep-2001  wiz Sort SEE ALSO.
 1.9  02-Apr-2001  wiz Fix format typo, and whitespace.
 1.8  29-Mar-2001  kleink Sprinkle some restrict.
 1.7  15-Jan-2000  kleink branches: 1.7.4; 1.7.6;
Add the C99 %F conversion.
 1.6  07-Feb-1999  augustss Compute week number right. Fixes PR 6961, from
Wolfgang Helbig <helbig@Informatik.BA-Stuttgart.DE>
 1.5  11-Feb-1998  kleink Change interval specification style from (a-b) to [a,b] where appropriate.
 1.4  05-Feb-1998  perry add LIBRARY section to man page
 1.3  09-Oct-1997  lukem rcsid police
 1.2  25-May-1997  kleink Add a reference to the strptime(3) manual page.
 1.1  23-Apr-1997  mrg move str[fp]time into libc/time.
 1.7.6.7  11-Nov-2002  nathanw Catch up to -current
 1.7.6.6  18-Oct-2002  nathanw Catch up to -current.
 1.7.6.5  27-Aug-2002  nathanw Catch up to -current.
 1.7.6.4  22-Mar-2002  nathanw Catch up to -current.
 1.7.6.3  08-Mar-2002  nathanw Catch up to -current.
 1.7.6.2  28-Jan-2002  nathanw Catch up to -current.
 1.7.6.1  08-Oct-2001  nathanw Catch up to -current.
 1.7.4.4  15-Dec-2002  he Pull up revision 1.17 (requested by kleink):
Fix typo UCT -> UTC. Fixes PR#19007.
 1.7.4.3  27-Dec-2001  he Undo pullup of revision 1.8 (requested by kleink):
No point in using the ``restrict'' qualifier on the netbsd-1-5 branch.
 1.7.4.2  24-Dec-2001  he Pull up revisions 1.8,1.10-1.12 (requested by kleink):
Switch to widely circulated tzcode (2000g) implementation; it
implements C99 features.
 1.7.4.1  04-Apr-2001  he Pull up revision 1.9 (requested by wiz):
Fix format typo, and whitespace.
 1.13.2.2  16-Apr-2004  jmc Pullup patch (requested by kleink in ticket #1670)

Add documentation for %v. PR#25180
 1.13.2.1  11-Dec-2002  he Pull up revision 1.17 (requested by kleink in ticket #978):
Fix typo UCT -> UTC. Fixes PR#19007.
 1.21.2.1  16-Apr-2004  jmc Pullup rev 1.22 (requested by kleink in ticket #141)

Add documentation for %v
 1.23.30.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.28.4.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.28.4.1  17-Apr-2012  yamt sync with head
 1.29.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.8.3  20-Mar-2017  pgoyette Sync with HEAD
 1.30.8.2  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.30.8.1  04-Nov-2016  pgoyette Sync with HEAD
 1.32.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.33.12.1  10-Jun-2019  christos Sync with HEAD
 1.33.10.1  20-Oct-2018  pgoyette Sync with head
 1.37.4.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed