aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdtime
Commit message (Collapse)AuthorAgeFilesLines
...
* | 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
* | MFV of tzcode2009h revision r192887Edwin Groothuis2009-05-271-1/+1
| | | | | | | | | | | | | | | | | | - Clarify the license for the tzcode: public domain MFC after: 1 month Notes: svn path=/head/; revision=192890
* | MFV of tzcode2009e:Edwin Groothuis2009-05-238-376/+922
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upgrade of the tzcode from 2004a to 2009e. Changes are numerous, but include... - New format of the output of zic, which supports both 32 and 64 bit time_t formats. - zdump on 64 bit platforms will actually produce some output instead of doing nothing for a looooooooong time. - linux_base-fX, with X >= at least 8, will work without problems related to the local time again. The original patch, based on the 2008e, has been running for a long time on both my laptop and desktop machine and have been tested by other people. After the installation of this code and the running of zic(8), you need to run tzsetup(8) again to install the new datafile. Approved by: wollman@ for usr.sbin/zic MFC after: 1 month Notes: svn path=/head/; revision=192625
* | Pass a pointer to warn2 so the warn2 == IN_ALL would not be anXin LI2008-10-301-1/+1
| | | | | | | | | | | | | | always-false condition. Notes: svn path=/head/; revision=184458
* | Clarify that "ante meridiem" and "post meridiem" mean the same thingGreg Lehey2008-05-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | as the more commonly used "a.m." and "p.m.". Tripped over by: Callum Gibson. MFC after: 2 weeks Notes: svn path=/head/; revision=179038
* | Normally, we are often reading local time rather than setting time zone,David Xu2008-04-011-22/+63
| | | | | | | | | | | | | | | | replace mutex with rwlock, this should eliminate lock contention in most cases. Notes: svn path=/head/; revision=177824
* | Reduce lock contention for simple cases.Warner Losh2007-12-191-16/+22
| | | | | | | | | | | | | | | | | | # this really should be done with pthread_once, but I've debugged this code. Reviewed by: arch@ Notes: svn path=/head/; revision=174766
* | Some libc symbol map cleanups.Daniel Eischen2007-05-311-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | net: endhostdnsent is named _endhostdnsent and is private to netdb family of functions. posix1e: acl_size.c has been never compiled in, so there's no "acl_size". rpc: "getnetid" is a static function. stdtime: "gtime" is #ifdef'ed out in the source. some symbols are specific only to some architectures, e.g., ___tls_get_addr is only defined on i386. __htonl, __htons, __ntohl and __ntohs are no longer functions, they are now (internal) defines in <machine/endian.h>. Submitted by: ru Notes: svn path=/head/; revision=170154
* | Use C comments since we now preprocess these files with CPP.Daniel Eischen2007-04-291-1/+3
| | | | | | | | Notes: svn path=/head/; revision=169092
* | On FreeBSD/arm, any value > 50 bits will result in a rediculously hugeWarner Losh2007-01-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | number being returned for mktime and timegm calls. Choose 48 because that works well. This does reduce the dynamic range of tm_year from about 2 billion years down to "only" about 9 million years. Please contact me if this restriction poses a problem. Due to the complexity of the code, I admit that I didn't trace down what, exactly, was overflowing with longer bits. This fixes software that we run on the embedded systems we have. Notes: svn path=/head/; revision=166102
* | Per Regents of the University of Calfornia letter, remove advertisingWarner Losh2007-01-092-8/+0
| | | | | | | | | | | | | | | | | | clause. # If I've done so improperly on a file, please let me know. Notes: svn path=/head/; revision=165903
* | add a missing the...John-Mark Gurney2006-12-191-1/+1
| | | | | | | | | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=165357
* | Add each directory's symbol map file to SYM_MAPS.Daniel Eischen2006-03-131-0/+2
| | | | | | | | Notes: svn path=/head/; revision=156613
* | Add symbol maps and initial symbol version definitions to libc.Daniel Eischen2006-03-131-0/+34
| | | | | | | | | | | | | | Reviewed by: davidxu Notes: svn path=/head/; revision=156608
* | The arguments for time2posix() and posix2time() are time_t values, notStefan Farfeleder2005-09-111-3/+3
| | | | | | | | | | | | | | pointers. Notes: svn path=/head/; revision=149995
* | Fix all the spelling mistakes I could find in the man pages for wordsGiorgos Keramidas2005-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | that have at least 3 characters. MFC after: 1 week Thanks to: Music band ``Chingon'' for keeping me company while searching for these. Notes: svn path=/head/; revision=148580
* | Expand contractions.Ruslan Ermilov2005-02-131-1/+1
| | | | | | | | Notes: svn path=/head/; revision=141851
* | Expand *n't contractions.Ruslan Ermilov2005-02-131-1/+1
| | | | | | | | Notes: svn path=/head/; revision=141846
* | Sort sections.Ruslan Ermilov2005-01-201-5/+5
| | | | | | | | Notes: svn path=/head/; revision=140505
* | Scheduled mdoc(7) sweep.Ruslan Ermilov2005-01-111-8/+10
| | | | | | | | Notes: svn path=/head/; revision=140081
* | Add glibc-style strftime(3) padding specifiers, namely, -(no padding),Xin LI2004-11-042-21/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _(use space as padding), and 0(zero padding). These GNU extensions are widely used ones that is worthy for us to have. Discussed with: stefanf, roam, -current Approved by: murray Prodded by: ports/72722, ports/72723 MFC After: 1 month Notes: svn path=/head/; revision=137190
* | struct tm.tm_year is listed as 'years since 1900', and is signed. OnPeter Wemm2004-08-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 64 bit systems, years roughly -2^31 through 2^31 can be represented in time_t without any trouble. 32 bit time_t systems only range from roughly 1902 through 2038. As a consequence, none of the date munging code for all the various calendar tweaks before then is present. There are other problems including the fact that there was no 'year zero' and so on. So rather than get excited about trying to figure out when the calendar jumped by two weeks etc, simply disallow negative (ie: prior to 1900) years. This happens to have an important side effect. If you bzero a 'struct tm', it corresponds to 'Jan 0, 1900, 00:00 GMT'. This happens to be representable (after canonification) in 64 bit time_t space. Zero tm structs are generally an error and mktime normally returns -1 for them. Interestingly, it tries to canonify the 'jan 0' to 'dec 31, 1899', ie: year -1. This conveniently trips the negative year test above, which means we can trivially detect the null 'tm' struct. This actually tripped up code at work. :-/ (Don't ask) Notes: svn path=/head/; revision=134231