History log of /src/lib/libc/time/asctime.c |
Revision | | Date | Author | Comments |
1.32 |
| 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.31 |
| 11-Sep-2024 |
christos | Merge tzcode-2024b
Release 2024b - 2024-09-04 12:27:47 -0700
Changes to code
localtime.c now always uses a TZif file's time type 0 to handle timestamps before the file's first transition. Formerly, localtime.c sometimes inferred a different time type, in order to handle problematic data generated by zic 2018e or earlier. As it is now safe to assume more recent versions of zic, there is no longer a pressing need to fail to conform RFC 8536 section 3.2, which requires using time type 0 in this situation. This change does not affect behavior when reading TZif files generated by zic 2018f and later.
POSIX.1-2024 removes asctime_r and ctime_r and does not let libraries define them, so remove them except when needed to conform to earlier POSIX. These functions are dangerous as they can overrun user buffers. If you still need them, add -DSUPPORT_POSIX2008 to CFLAGS.
The SUPPORT_C89 option now defaults to 1 instead of 0, fixing a POSIX-conformance bug introduced in 2023a.
tzselect now supports POSIX.1-2024 proleptic TZ strings. Also, it assumes POSIX.2-1992 or later, as practical porting targets now all support that, and it uses some features from POSIX.1-2024 if available.
Changes to build procedure
'make check' no longer requires curl and Internet access.
The build procedure now assumes POSIX.2-1992 or later, to simplify maintenance. To build on Solaris 10, the only extant system still defaulting to pre-POSIX, prepend /usr/xpg4/bin to PATH.
Changes to documentation
The documentation now reflects POSIX.1-2024.
Changes to commentary
Commentary about historical transitions in Portugal and her former colonies has been expanded with links to many relevant legislation. (Thanks to Tim Parenti.)
|
1.30 |
| 20-Jan-2024 |
christos | branches: 1.30.2; Catch up with all the lint warnings since exit on warning was disabled. Disable 'missing header declaration' and 'nested extern' warnings for now.
|
1.29 |
| 16-Sep-2023 |
christos | Update tzcode from 2022g to 2023c:
Release 2023c - 2023-03-28 12:42:14 -0700
Release 2023b - 2023-03-23 19:50:38 -0700
Release 2023a - 2023-03-22 12:39:33 -0700
Changes to code
You can now tell tzselect local time, to simplify later choices. Select the 'time' option in its first prompt.
You can now compile with -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255). The reference runtime library now rejects POSIX-style TZ strings that contain longer abbreviations, treating them as UTC. Previously the limit was platform dependent and abbreviations were silently truncated to 16 bytes even when the limit was greater than 16.
The code by default is now designed for C99 or later. To build in a C89 environment, compile with -DPORT_TO_C89. To support C89 callers of the tzcode library, compile with -DSUPPORT_C89. The two new macros are transitional aids planned to be removed in a future version, when C99 or later will be required.
The code now builds again on pre-C99 platforms, if you compile with -DPORT_TO_C89. This fixes a bug introduced in 2022f.
On C23-compatible platforms tzcode no longer uses syntax like 'static [[noreturn]] void usage(void);'. Instead, it uses '[[noreturn]] static void usage(void);' as strict C23 requires. (Problem reported by Houge Langley.)
The code's functions now constrain their arguments with the C 'restrict' keyword consistently with their documentation. This may allow future optimizations.
zdump again builds standalone with ckdadd and without setenv, fixing a bug introduced in 2022g. (Problem reported by panic.)
leapseconds.awk can now process a leap seconds file that never expires; this might be useful if leap seconds are discontinued.
Changes to commentary
tz-link.html has a new section "Coordinating with governments and distributors". (Thanks to Neil Fuller for some of the text.)
To improve tzselect diagnostics, zone1970.tab's comments column is now limited to countries that have multiple timezones.
Note that leap seconds are planned to be discontinued by 2035.
|
1.28 |
| 16-Aug-2022 |
christos | Welcome to 2022b:
zic has a new option '-R @N' to output explicit transitions < N. (Need suggested by Almaz Mingaleev.)
'zic -r @N' no longer outputs bad data when N < first transition. (Problem introduced in 2021d and reported by Peter Krefting.)
zic now checks its input for NUL bytes and unterminated lines, and now supports input line lengths up to 2048 (not 512) bytes.
gmtime and related code now use the abbreviation "UTC" not "GMT". POSIX is being revised to require this.
When tzset and related functions set vestigial static variables like tzname, they now prefer specified timestamps to unspecified ones. (Problem reported by Almaz Mingaleev.)
zic no longer complains "can't determine time zone abbreviation to use just after until time" when a transition to a new standard time occurs simultanously with the first DST fallback transition.
|
1.27 |
| 27-Jan-2019 |
dholland | fix mergeo
|
1.26 |
| 27-Jan-2019 |
pgoyette | Merge the [pgoyette-compat] branch
|
1.25 |
| 04-May-2018 |
christos | branches: 1.25.2; Merge 2018e
Changes to code
zic now accepts subsecond precision in expressions like 00:19:32.13, which is approximately the legal time of the Netherlands from 1835 to 1937. However, because it is questionable whether the few recorded uses of non-integer offsets had subsecond precision in practice, there are no plans for tzdata to use this feature. (Thanks to Steve Allen for pointing out the limitations of historical data in this area.)
The code is a bit more portable to MS-Windows. Installers can compile with -DRESERVE_STD_EXT_IDS on MS-Windows platforms that reserve identifiers like 'localtime'. (Thanks to Manuela Friedrich).
Changes to documentation and commentary
theory.html now outlines tzdb's extensions to POSIX's model for civil time, and has a section "POSIX features no longer needed" that lists POSIX API components that are now vestigial. (From suggestions by Steve Summit.) It also better distinguishes time zones from tz regions. (From a suggestion by Guy Harris.)
Commentary is now more consistent about using the phrase "daylight saving time", to match the C name tm_isdst. Daylight saving time need not occur in summer, and need not have a positive offset from standard time.
Commentary about historical transitions in Uruguay has been expanded with links to many relevant legal documents. (Thanks to Tim Parenti.)
Commentary now uses some non-ASCII characters with Unicode value less than U+0100, as they can be useful and should work even with older editors such as XEmacs.
|
1.24 |
| 07-Jan-2018 |
kamil | branches: 1.24.2; Revert asctime() namespacing
asctime() is optionally a cancellation point in the POSIX spec. It's not true for NetBSD.
Requested by <joerg>
|
1.23 |
| 05-Jan-2018 |
kamil | Register new weak symbol in libc for internal usage: asctime
The NetBSD Standard C Library uses internally some of its functions with a mangled symbol name, usually "_symbol". The internal functions shall not use the global (public) symbols.
Add asctime to namespace.h.
Register a new __weak_alias() entry for asctime() in asctime.c.
acstime() is used internally in ctime and __ctime50. This revision switches the internal usage to the internal symbol.
Sponsored by <The NetBSD Foundation>
|
1.22 |
| 24-Oct-2017 |
christos | Welcome to 2017c:
zic and the reference runtime now reject multiple leap seconds within 28 days of each other, or leap seconds before the Epoch. As a result, support for double leap seconds, which was obsolescent and undocumented, has been removed. Double leap seconds were an error in the C89 standard; they have never existed in civil timekeeping. (Thanks to Robert Elz and Bradley White for noticing glitches in the code that uncovered this problem.)
zic now warns about use of the obsolescent and undocumented -y option, and about use of the obsolescent TYPE field of Rule lines.
zic now allows unambiguous abbreviations like "Sa" and "Su" for weekdays; formerly it rejected them due to a bug. Conversely, zic no longer considers non-prefixes to be abbreviations; for example, it no longer accepts "lF" as an abbreviation for "lastFriday". Also, zic warns about the undocumented usage with a "last-" prefix, e.g., "last-Fri".
Similarly, zic now accepts the unambiguous abbreviation "L" for "Link" in ordinary context and for "Leap" in leap-second context. Conversely, zic no longer accepts non-prefixes such as "La" as abbreviations for words like "Leap".
zic no longer accepts leap second lines in ordinary input, or ordinary lines in leap second input. Formerly, zic sometimes warned about this undocumented usage and handled it incorrectly.
The new macro HAVE_TZNAME governs whether the tzname external variable is exported, instead of USG_COMPAT. USG_COMPAT now governs only the external variables "timezone" and "daylight". This change is needed because the three variables are not in the same category: although POSIX requires tzname, it specifies the other two variables as optional. Also, USG_COMPAT is now 1 or 0: if not defined, the code attempts to guess it from other macros.
localtime.c and difftime.c no longer require stdio.h, and .c files other than zic.c no longer require sys/wait.h.
zdump.c no longer assumes snprintf. (Reported by Jonathan Leffler.)
Calculation of time_t extrema works around a bug in GCC 4.8.4 (Reported by Stan Shebs and Joseph Myers.)
zic.c no longer mistranslates formats of line numbers in non-English locales. (Problem reported by Benno Schulenberg.)
Several minor changes have been made to the code to make it a bit easier to port to MS-Windows and Solaris. (Thanks to Kees Dekker for reporting the problems.)
Changes to documentation and commentary
The two new files 'theory.html' and 'calendars' contain the contents of the removed file 'Theory'. The goal is to document tzdb theory more accessibly.
The zic man page now documents abbreviation rules.
tz-link.htm now covers how to apply tzdata changes to clients. (Thanks to Jorge Fábregas for the AIX link.) It also mentions MySQL.
The leap-seconds.list URL has been updated to something that is more reliable for tzdb. (Thanks to Tim Parenti and Brian Inglis.)
|
1.21 |
| 11-Mar-2017 |
christos | merge 2017a
|
1.20 |
| 23-Oct-2014 |
christos | branches: 1.20.2; 1.20.4; merge 2014i
|
1.19 |
| 15-Aug-2014 |
christos | merge tzcode2014f via patch
|
1.18 |
| 28-Oct-2012 |
christos | branches: 1.18.8; welcome to tzcode2012h via patch.
|
1.17 |
| 26-Oct-2012 |
christos | remove unused constant
|
1.16 |
| 24-Oct-2012 |
christos | apply 2012g via patch
|
1.15 |
| 25-Jun-2012 |
abs | branches: 1.15.2; Update old-style definitions to ANSI, remove a couple of register definitions along the way. Fixed gcc 4.1 build (thank you vax)
|
1.14 |
| 04-Sep-2011 |
christos | branches: 1.14.2; bring in the 2011i changes.
|
1.13 |
| 31-Dec-2009 |
mlelstv | Import tzcode2009k. - now understands 64bit time_t and 64bit data in timezone files. - localtime(), gmtime(), asctime() and ctime() may now fail with a NULL result if time_t cannot be represented by struct tm.
|
1.12 |
| 15-Oct-2006 |
perry | Make the declarations of wday_name and mon_name less eccentric. I suppose they were legal before, but lint was unhappy about them. It was probably unhappy for the wrong reasons, but I think it certainly wasn't something one would want anyway. Declaring a string of length three to have storage of length three without room for the nul is asking for trouble even if it does work in context, and there was no reason not to state how many days there are in a week or months in a year -- they aren't onerous and aren't going to change.
NOTE: If this code isn't being synced with the central TZCODE stuff, it probably should be KNFed etc. It is full of K&R declarations, register, lots of eccentricities, etc.
|
1.11 |
| 13-Sep-2000 |
msaitoh | check LIBC_SCCS
|
1.10 |
| 22-Jan-2000 |
mycroft | Delint. Remove trailing ; from uses of __weak_alias(). The macro inserts this if needed.
|
1.9 |
| 08-Oct-1998 |
kleink | Oops, also needs "namespace.h".
|
1.8 |
| 11-Sep-1998 |
kleink | Restore `elsieid' accidently clobbered during merge.
|
1.7 |
| 10-Sep-1998 |
kleink | Merge tzcode1998f.
|
1.6 |
| 13-Jul-1997 |
christos | Fix RCSID's
|
1.5 |
| 18-Jun-1997 |
jtc | Sync with tzcode1997e
|
1.4 |
| 23-Jan-1997 |
mrg | - convert unsafe strcpy(), strcat() and sprintf() to the `n' versions. - some KNF.
|
1.3 |
| 10-Sep-1996 |
jtc | sync with tzcode96l
|
1.2 |
| 09-Mar-1995 |
jtc | branches: 1.2.2; Add NetBSD Id's.
|
1.1 |
| 09-Mar-1995 |
jtc | branches: 1.1.1; Initial revision
|
1.1.1.5 |
| 25-Oct-2009 |
mlelstv | import tzcode2009k
|
1.1.1.4 |
| 10-Sep-1998 |
kleink | Import tzcode1998f.
|
1.1.1.3 |
| 18-Jun-1997 |
jtc | import tzcode1997e
|
1.1.1.2 |
| 10-Sep-1996 |
jtc | import tzcode96l
|
1.1.1.1 |
| 09-Mar-1995 |
jtc | New time and date code from ADO
|
1.2.2.2 |
| 09-Mar-1995 |
jtc | Add NetBSD Id's.
|
1.2.2.1 |
| 09-Mar-1995 |
jtc | file asctime.c was added on branch ivory_soap on 1995-03-09 23:41:12 +0000
|
1.14.2.1 |
| 30-Oct-2012 |
yamt | sync with head
|
1.15.2.1 |
| 20-Nov-2012 |
tls | Resync to 2012-11-19 00:00:00 UTC
|
1.18.8.1 |
| 25-Jan-2015 |
martin | Pull up the following revisions via patch, requested by apb in ticket #453:
doc/3RDPARTY up to 1.1195 usr.sbin/zdump/Makefile up to 1.9 usr.sbin/zic/Makefile up to 1.15 lib/libc/time/Makefile up to 1.25 lib/libc/time/Makefile.inc up to 1.21 lib/libc/time/NEWS up to 1.8 lib/libc/time/README up to 1.9 lib/libc/time/Theory up to 1.16 lib/libc/time/asctime.c up to 1.20 lib/libc/time/checktab.awk up to 1.8 lib/libc/time/ctime.3 up to 1.51 lib/libc/time/getdate.c up to 1.3 lib/libc/time/localtime.c up to 1.92 lib/libc/time/private.h up to 1.38 lib/libc/time/strftime.c up to 1.33 lib/libc/time/time2posix.3 up to 1.19 lib/libc/time/tz-art.htm up to 1.8 lib/libc/time/tz-link.htm up to 1.20 lib/libc/time/tzfile.5 up to 1.22 lib/libc/time/tzfile.h up to 1.16 lib/libc/time/tzselect.8 up to 1.6 lib/libc/time/tzselect.ksh up to 1.12 lib/libc/time/tzset.3 up to 1.31 lib/libc/time/zdump.8 up to 1.14 lib/libc/time/zdump.c up to 1.40 lib/libc/time/zic.8 up to 1.24 lib/libc/time/zic.c up to 1.52
Update tzcode from 2014e to 2014j.
|
1.20.4.1 |
| 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.20.2.1 |
| 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.24.2.1 |
| 21-May-2018 |
pgoyette | Sync with HEAD
|
1.25.2.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.30.2.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|