summaryrefslogtreecommitdiff
path: root/lib/libc/stdtime
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Add strptime(3) support for %U and %WPedro F. Giffuni2014-09-251-5/+126
| | | | | | | | | | | | | | | | | 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 with important fixes by Andrey Chernov. Additional support for handling tm_wday/tm_yday was written by David Carlier. PR: 137307 MFC after: 1 month Notes: svn path=/head/; revision=272122
* strftime() xlocale cleanups.Pedro F. Giffuni2014-07-261-37/+46
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=269124
* strptime: add support for %t and %nPedro F. Giffuni2014-06-181-38/+20
| | | | | | | | | | | | | | | | | | Posix strptime() requires support for %t and %n, which were added to the illumos port. Curiously we were skipping white spaces by default in most other cases making %t meaningless. We now skip spaces in the case of the %e specifier as strftime(3) explicitly adds a space for the single digit case. Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html Obtained from: Illumos (Rev. a11c1571b6942161b0186d0588609448066892c2) MFC after: 3 weeks Notes: svn path=/head/; revision=267627
* Fix syntax error.Warren Block2014-06-181-1/+1
| | | | | | | | | PR: 191131 Submitted by: dan.mcgregor@usask.ca MFC after: 1 week Notes: svn path=/head/; revision=267618
* stdtime: style(9) fixes.Pedro F. Giffuni2014-06-183-184/+186
| | | | | | | | Obtained from: illumos MFC after: 5 days Notes: svn path=/head/; revision=267601
* Update license to strptime(3) implementation.Pedro F. Giffuni2014-06-161-28/+5
| | | | | | | | | | | | | | | | | | | | | | | Our strptime(3) implementation was the base for the illumos implementation and after contacting the author, Kevin Rudy stated the code is under a 2-Clause BSD License [1] After reviewing our local changes to the file in question, the FreeBSD Foundation has agreed that their contributions to this file are not required to carry clause 3 or 4 so the file can be relicensed as in Illumos [2]. References: [1] https://www.illumos.org/issues/357 [2] Illumos Revision: 13222:02526851ba75 Approved: core (jhb) Approved: FreeBSD Foundation (emaste) MFC after: 4 days Notes: svn path=/head/; revision=267544
* Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}Marcel Moolenaar2014-03-041-4/+4
| | | | | | | | | | | | | | if not already defined. This allows building libc from outside of lib/libc using a reach-over makefile. A typical use-case is to build a standard ILP32 version and a COMPAT32 version in a single iteration by building the COMPAT32 version using a reach-over makefile. Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=262722
* Compile contrib/tzcode/stdtime/localtime.c with -fwrapv, since it reliesDimitry Andric2013-03-241-0/+3
| | | | | | | | | | | | | | | | on signed integer overflow wrapping. Otherwise mktime(3) and timegm(3) can hang, in case the timestamp passed in struct tm is not representable in a time_t. Specifically, any timestamp after 2038-01-19 03:14:07, in combination with a 32-bit time_t. Note that it would be better to change the code to not rely on undefined behaviour, but it is contributed code, and it is not entirely trivial to fix the issue properly. MFC after: 3 days Notes: svn path=/head/; revision=248672
* Add more locale-specific functions to the relevant man pages andIsabell Long2012-06-253-2/+27
| | | | | | | | | | | | | Makefiles: - libc/stdtime/strftime.3 - libc/stdtime/strptime.3 - libc/stdlib/strfmon.3 Reviewed by: theraven Approved by: gabor (mentor) Notes: svn path=/head/; revision=237573
* libc: Reduce relative relocations in strftime().Jilles Tjoelker2012-06-171-1/+1
| | | | Notes: svn path=/head/; revision=237211
* Implement xlocale APIs from Darwin, mainly for use by libc++. This adds aDavid Chisnall2011-11-204-100/+197
| | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=227753
* strptime(3) confused July with June with the fr_FR locale.Edwin Groothuis2010-05-091-0/+8
| | | | | | | | | | | | | | | | When parsing the month "juillet" (abbr "jul"), %B recognized it as "juin" (abbr "jui") because the full name of the month names is checked at the same time as the abbrevation. The new behaviour checks the full names first before checking the abbrevation names. PR: kern/141939 Submitted by: Denis Chatelain <denis@tikuts.com> MFC after: 1 week Notes: svn path=/head/; revision=207830
* Split the contributed code from libc/stdtime from lib/libc/stdtimeEdwin Groothuis2010-02-269-3620/+4
| | | | | | | to contrib/tzcode/stdtime. Notes: svn path=/head/; revision=204347
* %U was macroized in mdoc(7), escape.Ruslan Ermilov2010-02-161-1/+1
| | | | Notes: svn path=/head/; revision=203958
* Use _pthread_once() rather than _once() for localtime() and gmtime(). TheseJohn Baldwin2010-01-061-2/+2
| | | | | | | | | | methods are only invoked when __isthreaded is true at which point it is safe to use _pthread_once() directly. MFC after: 1 week Notes: svn path=/head/; revision=201669
* Use _once() to initialize the pthread key for thread-local storage to holdJohn Baldwin2009-12-301-14/+14
| | | | | | | | | the results of gmtime() instead of using a pthread mutex directly. MFC after: 1 week Notes: svn path=/head/; revision=201270
* MFV of tzdata2009t, r200831Edwin Groothuis2009-12-221-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | zic: - Fix URL / reference to Calendrical Calculations: Third Edition libc/stdtime: - Fix typo in tzfile.5 (no changes in our part) MFC after: 1 week Notes: svn path=/head/; revision=200832
| * Flatten the dist tree of vendor/tzcodeEdwin Groothuis2008-09-278-3321/+0
| | | | | | | | Notes: svn path=/vendor/tzcode/dist/; revision=183400
| * Import tzcode2004a.Stefan Farfeleder2004-06-145-133/+398
| | | | | | | | | | | | | | Obtained from: ftp://elsie.nci.nih.gov/pub/tzcode2004a.tar.gz Notes: svn path=/vendor/tzcode/dist/; revision=130459
| * Update timezone file description to match new zic (coming soon).Garrett Wollman1999-01-212-10/+28
| | | | | | | | | | | | | | Update man page to reflect reality. Notes: svn path=/vendor/tzcode/dist/; revision=42986
| * Import the 96h release of ADO's timezone code. This release isGarrett Wollman1996-07-186-421/+809
| | | | | | | | | | | | | | | | | | 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. Notes: svn path=/vendor/tzcode/dist/; revision=17208
| * recording cvs-1.6 file deathPeter Wemm1995-12-301-1530/+0
| | | | | | | | Notes: svn path=/vendor/tzcode/dist/; revision=13122
* | Use _once() to initialize the pthread key for thread-local storage to holdJohn Baldwin2009-12-211-14/+14
| | | | | | | | | | | | | | | | | | the results of localtime() instead of using a pthread mutex directly. MFC after: 1 week Notes: svn path=/head/; revision=200797
* | Replace gmt_is_set and the gmt_mutex lock with a pthread_once_t variable andJohn Baldwin2009-11-201-12/+13
| | | | | | | | | | | | | | | | | | an init routine run on the first invocation via _once(). MFC after: 1 week Notes: svn path=/head/; revision=199607
* | Improve the way failure of pthread_key_create() gets detected.Edwin Groothuis2009-09-141-2/+9
| | | | | | | | | | | | | | | | | | PR: threads/138603 Submitted by: Mikulas Patocka MFC after: 1 week Notes: svn path=/head/; revision=197189
* | Use (unsigned char) cast for ctype macroAndrey A. Chernov2009-09-021-1/+1
| | | | | | | | Notes: svn path=/head/; revision=196752
* | Implement %z for strptime.Xin LI2009-06-251-0/+28
| | | | | | | | | | | | | | | | | | PR: kern/63064 Submitted by: Stefan `Sec` Zehl <sec 42 org> (with some small changes) MFC after: 1 month Notes: svn path=/head/; revision=195015
* | Remove duplicate if-statement on gmt_is_set in gmtsub().Edwin Groothuis2009-06-231-8/+6
| | | | | | | | | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=194783
* | Spacing fixes. No actual change.Xin LI2009-06-091-2/+2
| | | | | | | | Notes: svn path=/head/; revision=193817