summaryrefslogtreecommitdiff
path: root/lib/libc/stdtime
AgeCommit message (Collapse)Author
2025-10-15libc: Add "Z" as TZ designator for strptime.Gordon Tetlow
ISO 8601 allows use of "Z" as the time zone designator. Update the strptime parser to allow this usage. While we are at it, update the manpage to reflect that both UTC and Z are now valid options. Reviewed by: des MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D53083
2025-09-30libc: Add missing MLINK for tzname(3)Dag-Erling Smørgrav
While here, fix manlint warnings and a typo in tzset(3). MFC after: 3 days
2025-09-23tzcode: Expose and document offtime() and offtime_r()Dag-Erling Smørgrav
Includes diff reduction to upstream version of this patch. MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: philip Differential Revision: https://reviews.freebsd.org/D39715
2025-07-18libc: Test time zone change detection.Dag-Erling Smørgrav
While here, clean the detection code up a bit. Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51343
2025-05-21SPDX: Tag BSD-4.3TAHOEAlexander Ziaee
TIL traceroute.8 has one of the oldest liceses, predating BSD-4-Clause! The SPDX tag was not even on Wikipedia. These are all the files I could find in the tree with git grep that look like the license reported on the SPDX website, including one that was misfiled. Ref: https://spdx.org/licenses/BSD-4.3TAHOE.html MFC after: 3 days Reported by: brooks Reviewed by: brooks, carlavilla, imp, ivy Approved by: carlavilla (mentor) Differential Revision: https://reviews.freebsd.org/D50362
2024-12-09strptime: Fix day-of-week calculation.Dag-Erling Smørgrav
The day-of-week calculation used the raw year value without adjusting for TM_YEAR_BASE, so it was off by one for 300 years out of every 400; it just happened to be correct for 1901 through 2000. It also used a loop where a simple addition would have sufficed. While here, simplify our version of Gauss's algorithm, and document that we assume the Gregorian calendar. MFC after: 1 week PR: 282916 Reviewed by: imp, allanjude, philip Differential Revision: https://reviews.freebsd.org/D47977
2024-03-27libc: Improve description of mktime() / timegm().Dag-Erling Smørgrav
* Mention that mktime() and timegm() set errno on failure. * Correctly determining whether mktime() / timegm() succeeded with arbitrary input (where -1 can be a valid result) is non-trivial. Document the recommended procedure. PR: 277863 MFC after: 1 week Reviewed by: pauamma_gundo.com, gbe Differential Revision: https://reviews.freebsd.org/D44503
2024-03-11libc: Move tzset.3 to stdtimeWarner Losh
This really belongs in stddime, since it documents interfaces implemented in stdtime. Suggested by: brooks Sponsored by: Netflix
2024-03-11timezone: Move to the XSI/POSIX definition for timezone.Warner Losh
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
2024-02-13Update tzcode to 2024a.Dag-Erling Smørgrav
MFC after: 3 weeks Sponsored by: Klara, Inc.
2023-11-26Remove copyright strings ifdef'd outWarner Losh
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
2023-11-26lib: Remove ancient SCCS tags.Warner Losh
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
2023-11-15libc: Remove empty comments in Symbol.mapBrooks Davis
These were left over from $FreeBSD$ removal. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D42612
2023-11-01libc: Purge unneeded cdefs.hWarner Losh
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
2023-08-16Remove $FreeBSD$: one-line nroff patternWarner Losh
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16Remove $FreeBSD$: two-line nroff patternWarner Losh
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16Remove $FreeBSD$: one-line sh patternWarner Losh
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16Remove $FreeBSD$: one-line .h patternWarner Losh
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2023-04-26tzcode: Clean up the ctime(3) manual page.Dag-Erling Smørgrav
MFC after: 3 weeks Sponsored by: Klara, Inc. Reviewed by: pauamma_gundo.com Differential Revision: https://reviews.freebsd.org/D39714
2023-04-26Update tzcode to 2023c.Dag-Erling Smørgrav
MFC after: 3 weeks Sponsored by: Klara, Inc. Reviewed by: philip Differential Revision: https://reviews.freebsd.org/D39712
2023-03-07libc: Remove prototype and documentation for tzsetwall().Dag-Erling Smørgrav
PR: 269445 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D38481
2023-01-11tzcode: Move configuration into separate header.Dag-Erling Smørgrav
MFC after: 1 week Sponsored by: Klara, Inc.
2023-01-10Bring our tzcode up to date.Dag-Erling Smørgrav
* 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.
2022-08-04libc: drop "All rights reserved" from Foundation copyrightsEd Maste
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
2022-02-07strftime.3: Fix a typo and use St for standardsMateusz Piotrowski
MFC after: 1 week
2021-09-12tzcode: Implement timezone change detectionEdward Tomasz Napierala
Implement optional timezone change detection for local time libc functions. This is disabled by default; set WITH_DETECT_TZ_CHANGES to build it. Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #47 Differential Revision: https://reviews.freebsd.org/D30183
2018-11-03strptime: make %k and %l specifiers match their description inYuri Pankov
strftime(3), and allow them to process space-padded input. PR: 230720 Submitted by: rlittle@inetco.com (original version) Approved by: kib (mentor, implicit) Differential Revision: https://reviews.freebsd.org/D17761 Notes: svn path=/head/; revision=340106
2018-10-17strptime: fix parsing of tm_year when both %C and %y appear in theYuri Pankov
format string in arbitrary order. This makes the related test cases in lib/libc/tests/time (not yet connected to the build) pass. While here, don't error on negative tm_year value based on the APPLICATION USAGE in http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html (glibc does the same): tm_year is a signed value; therefore, years before 1900 may be represented. Approved by: re (gjb), kib (mentor) Differential Revision: https://reviews.freebsd.org/D17550 Notes: svn path=/head/; revision=339408
2018-10-13strptime: disallow zero hour for %I (defined by POSIX as [01,12]) and %lYuri Pankov
(extension, defined in strftime(3) as 1-12). Approved by: re (gjb), kib (mentor) Differential Revision: https://reviews.freebsd.org/D17543 Notes: svn path=/head/; revision=339346
2018-10-08Disallow zero day of month from strptime("%d").Konstantin Belousov
It is required by POSIX, specified in our man page, and followed by Linux. PR: 232072 Reported by: miguel_tete17@hotmail.com Sponsored by: The FreeBSD Foundation Approved by: re (gjb) MFC after: 1 week Notes: svn path=/head/; revision=339241
2017-11-25libc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni
Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. 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. Notes: svn path=/head/; revision=326193
2017-02-28Renumber copyright clause 4Warner Losh
Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
2017-01-20Replace dot-dot relative pathing with SRCTOP-relative paths where possibleEnji Cooper
This reduces build output, need for recalculating paths, and makes it clearer which paths are relative to what areas in the source tree. The change in performance over a locally mounted UFS filesystem was negligible in my testing, but this may more positively impact other filesystems like NFS. LIBC_SRCTOP was left alone so Juniper (and other users) can continue to manipulate lib/libc/Makefile (and other Makefile.inc's under lib/libc) as include Makefiles with custom options. Discussed with: marcel, sjg MFC after: 1 week Reviewed by: emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D9207 Notes: svn path=/head/; revision=312451
2017-01-20libc: remove reference to nonexistent lib/locale directoryEd Maste
As far as I can tell this was introduced in r72406 and updated in several subsequent revisions, but the lib/locale directory it referenced never existed. Reviewed by: ngie Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9252 Notes: svn path=/head/; revision=312446
2016-09-211) For already non-standard %z extension implement GNU compatible formats:Andrey A. Chernov
+hh and -hh. 2) Check for incorrect values for %z. MFC after: 7 days Notes: svn path=/head/; revision=306109
2016-09-211) Microoptimize %p case.Andrey A. Chernov
2) Implememt %u for GNU compatibility. 3) Don't forget to advance buf for %w/%u. 4) Fail with incomplete week (week 0) request and no such week in the year. 5) Fix yday formula when Sunday requested and the week started from Monday. 6) Fail with impossible yday for incomplete week (week 0) and direct %w/%u request. 7) Shift yday/wday to the first day of the year, if incomplete week (week 0) requested and no %w/%u used. MFC after: 7 days Notes: svn path=/head/; revision=306075
2016-03-26Implement (ACFLAGS|CFLAGS|CXXFLAGS).SRC globally.Bryan Drewery
Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=297283
2015-09-20Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.Craig Rodrigues
Notes: svn path=/head/; revision=288039
2014-10-071) Fix the case we have less arguments for format string than we expected.Andrey A. Chernov
2) Return error on unsupported format specs. (both according to POSIX) PR: 93197 Notes: svn path=/head/; revision=272679
2014-10-07Back out timegm error check from r272562.Andrey A. Chernov
POSIX treats negative time_t as undefined (i.e. may be valid too, depends on system's policy we don't have) and we don't set EOVERFLOW in mktime/timegm as POSIX requires to surely distinguish -1 return as valid negative time from -1 as error return. Notes: svn path=/head/; revision=272678
2014-10-051) For %Z format, understand "UTC" name too.Andrey A. Chernov
2) Return NULL if timegm() fails, because it means we can convert what we have in GMT to local time needed. Notes: svn path=/head/; revision=272562
2014-10-04Minor doc format fix.Pedro F. Giffuni
Submitted by: Yonghyeon PYUN Notes: svn path=/head/; revision=272533
2014-10-02strptime(3): Update manpage for %U and %W.Pedro F. Giffuni
%U and %W were implemented as part of r272273 so take them out of the BUGS section and mention them in the SYNOPSIS. MFC after: 1 month Notes: svn path=/head/; revision=272443
2014-10-02strptime: %s format fix.Pedro F. Giffuni
Almost never needed in real life because %s is tends to be only one format spec. 1) Return code of gmtime_r() is checked. 2) All flags are set. Submitted by: ache MFC after: 3 weeks Notes: svn path=/head/; revision=272441
2014-10-01strptime: fix bug introduced in r272273.Pedro F. Giffuni
Reported by: portmgr (antoine) Fix by: Andrey Chernov, David Carlier PR: 137307 (follow up) Notes: svn path=/head/; revision=272387
2014-09-28Add strptime(3) support for %U and %W (take 2)Pedro F. Giffuni
Add support for the missing POSIX-2001 %U and %W features: the existing FreeBSD strptime code recognizes both directives and validates that the week number lies in the permitted range, but then simply discards the value. Initial support for the feature was written by Paul Green. David Carlier added the initial handling of tm_wday/tm_yday. Major credit goes to Andrey Chernov for detecting much of the brokenness, and rewriting/cleaning most of the code, making it much more robust. Tested independently with the strptime test from the GNU C library. PR: 137307 MFC after: 1 month Relnotes: yes Notes: svn path=/head/; revision=272273
2014-09-25Revert r272122Pedro F. Giffuni
The patch still needs to be more robust and it broke the build on MIPS so revert it for now while all the issues are fixed. Reported by: ache, davide PR: 137307 Notes: svn path=/head/; revision=272146