aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdtime
Commit message (Collapse)AuthorAgeFilesLines
* libc: Add "Z" as TZ designator for strptime.Gordon Tetlow2025-10-152-2/+3
| | | | | | | | | | | | 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
* libc: Add missing MLINK for tzname(3)Dag-Erling Smørgrav2025-09-302-36/+24
| | | | | | While here, fix manlint warnings and a typo in tzset(3). MFC after: 3 days
* tzcode: Expose and document offtime() and offtime_r()Dag-Erling Smørgrav2025-09-231-6/+33
| | | | | | | | | 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
* libc: Test time zone change detection.Dag-Erling Smørgrav2025-07-182-0/+7
| | | | | | | | | 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
* SPDX: Tag BSD-4.3TAHOEAlexander Ziaee2025-05-211-0/+2
| | | | | | | | | | | | | | 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
* strptime: Fix day-of-week calculation.Dag-Erling Smørgrav2024-12-092-15/+14
| | | | | | | | | | | | | | | 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
* libc: Improve description of mktime() / timegm().Dag-Erling Smørgrav2024-03-271-2/+16
| | | | | | | | | | | | * 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
* libc: Move tzset.3 to stdtimeWarner Losh2024-03-122-1/+347
| | | | | | | | This really belongs in stddime, since it documents interfaces implemented in stdtime. Suggested by: brooks Sponsored by: Netflix
* timezone: Move to the XSI/POSIX definition for timezone.Warner Losh2024-03-121-0/+5
| | | | | | | | | | | | | | 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
* Update tzcode to 2024a.Dag-Erling Smørgrav2024-02-131-1/+1
|\ | | | | | | | | MFC after: 3 weeks Sponsored by: Klara, Inc.
* | Remove copyright strings ifdef'd outWarner Losh2023-11-272-18/+0
| | | | | | | | | | | | | | | | | | | | | | 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
* | lib: Remove ancient SCCS tags.Warner Losh2023-11-273-7/+0
| | | | | | | | | | | | | | | | 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
* | libc: Remove empty comments in Symbol.mapBrooks Davis2023-11-151-3/+0
| | | | | | | | | | | | | | These were left over from $FreeBSD$ removal. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D42612
* | libc: Purge unneeded cdefs.hWarner Losh2023-11-013-3/+0
| | | | | | | | | | | | | | | | | | 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
* | Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-162-2/+0
| | | | | | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* | Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | | | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* | Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | | | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* | Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-164-8/+0
| | | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* | Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-161-1/+0
| | | | | | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* | Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | | | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* | spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-123-3/+3
| | | | | | | | | | | | | | | | | | 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
* | tzcode: Clean up the ctime(3) manual page.Dag-Erling Smørgrav2023-04-261-102/+89
| | | | | | | | | | | | | | MFC after: 3 weeks Sponsored by: Klara, Inc. Reviewed by: pauamma_gundo.com Differential Revision: https://reviews.freebsd.org/D39714
* | Update tzcode to 2023c.Dag-Erling Smørgrav2023-04-261-0/+1
|\| | | | | | | | | | | | | MFC after: 3 weeks Sponsored by: Klara, Inc. Reviewed by: philip Differential Revision: https://reviews.freebsd.org/D39712
* | libc: Remove prototype and documentation for tzsetwall().Dag-Erling Smørgrav2023-03-071-4/+2
| | | | | | | | | | | | PR: 269445 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D38481
* | tzcode: Move configuration into separate header.Dag-Erling Smørgrav2023-01-111-7/+10
| | | | | | | | | | MFC after: 1 week Sponsored by: Klara, Inc.
* | Bring our tzcode up to date.Dag-Erling Smørgrav2023-01-104-4/+414
|\| | | | | | | | | | | | | | | | | | | * 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.
* | libc: drop "All rights reserved" from Foundation copyrightsEd Maste2022-08-044-4/+4
| | | | | | | | | | | | | | | | | | 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
* | strftime.3: Fix a typo and use St for standardsMateusz Piotrowski2022-02-071-2/+3
| | | | | | | | MFC after: 1 week
* | tzcode: Implement timezone change detectionEdward Tomasz Napierala2021-09-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | strptime: make %k and %l specifiers match their description inYuri Pankov2018-11-031-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | strptime: fix parsing of tm_year when both %C and %y appear in theYuri Pankov2018-10-171-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | strptime: disallow zero hour for %I (defined by POSIX as [01,12]) and %lYuri Pankov2018-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | (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
* | Disallow zero day of month from strptime("%d").Konstantin Belousov2018-10-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | libc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-253-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Replace dot-dot relative pathing with SRCTOP-relative paths where possibleEnji Cooper2017-01-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | libc: remove reference to nonexistent lib/locale directoryEd Maste2017-01-201-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | 1) For already non-standard %z extension implement GNU compatible formats:Andrey A. Chernov2016-09-211-0/+6
| | | | | | | | | | | | | | | | | | | | +hh and -hh. 2) Check for incorrect values for %z. MFC after: 7 days Notes: svn path=/head/; revision=306109
* | 1) Microoptimize %p case.Andrey A. Chernov2016-09-211-14/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Implement (ACFLAGS|CFLAGS|CXXFLAGS).SRC globally.Bryan Drewery2016-03-261-1/+0
| | | | | | | | | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=297283
* | Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.Craig Rodrigues2015-09-201-25/+7
| | | | | | | | Notes: svn path=/head/; revision=288039
* | 1) Fix the case we have less arguments for format string than we expected.Andrey A. Chernov2014-10-071-4/+3
| | | | | | | | | | | | | | | | | | | | 2) Return error on unsupported format specs. (both according to POSIX) PR: 93197 Notes: svn path=/head/; revision=272679
* | Back out timegm error check from r272562.Andrey A. Chernov2014-10-071-2/+0
| | | | | | | | | | | | | | | | | | | | 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
* | 1) For %Z format, understand "UTC" name too.Andrey A. Chernov2014-10-051-1/+5
| | | | | | | | | | | | | | | | 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
* | Minor doc format fix.Pedro F. Giffuni2014-10-041-1/+2
| | | | | | | | | | | | | | Submitted by: Yonghyeon PYUN Notes: svn path=/head/; revision=272533
* | strptime(3): Update manpage for %U and %W.Pedro F. Giffuni2014-10-021-10/+6
| | | | | | | | | | | | | | | | | | | | %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
* | strptime: %s format fix.Pedro F. Giffuni2014-10-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | strptime: fix bug introduced in r272273.Pedro F. Giffuni2014-10-011-1/+2
| | | | | | | | | | | | | | | | | | Reported by: portmgr (antoine) Fix by: Andrey Chernov, David Carlier PR: 137307 (follow up) Notes: svn path=/head/; revision=272387
* | Add strptime(3) support for %U and %W (take 2)Pedro F. Giffuni2014-09-281-7/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Revert r272122Pedro F. Giffuni2014-09-251-126/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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