summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdtime
Commit message (Collapse)AuthorAgeFilesLines
* MFC r306075,r306109ache2016-09-281-14/+32
| | | | | | | | | | | | | | | | | | 1) Microoptimize %p case. 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. 8) For already non-standard %z extension implement GNU compatible formats: +hh and -hh. 9) Check for incorrect values for %z. PR: 212983 (case 3 only)
* MFC r272562,r272678,r272679ache2014-10-191-5/+6
| | | | | | | | | 1) Fix the case we have less arguments for format string than we expected. 2) Return error on unsupported format specs. (both according to POSIX) 3) For %Z format, understand "UTC" name too. PR: 93197
* MFC r272273, r272387, r272443, r272533 :pfg2014-10-082-16/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add strptime(3) support for %U and %W 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 Relnotes: yes MFC r272441 : strptime: %s format fix. 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 r269124:pfg2014-08-031-37/+46
| | | | | | | | | | | | strftime() xlocale cleanups. 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() since it calls _conv() Obtained from: Apple Inc. (Libc 997.90.3) CR: D482 Reviewed by: theraven
* MFC r267618:wblock2014-07-151-1/+1
| | | | Fix syntax error.
* MFC r267627:pfg2014-06-301-38/+20
| | | | | | | | | | | | | | | | | strptime: add support for %t and %n 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 PR: 173421 Obtained from: Illumos (Rev. a11c1571b6942161b0186d0588609448066892c2)
* MFC r267601:pfg2014-06-233-184/+186
| | | | | | stdtime: style(9) fixes. Obtained from: illumos
* MFC r267544:pfg2014-06-201-28/+5
| | | | | | | | | | | | | | | | | | | | | Update license to strptime(3) implementation. 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)
* Compile contrib/tzcode/stdtime/localtime.c with -fwrapv, since it reliesdim2013-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
* Add more locale-specific functions to the relevant man pages andissyl02012-06-253-2/+27
| | | | | | | | | | Makefiles: - libc/stdtime/strftime.3 - libc/stdtime/strptime.3 - libc/stdlib/strfmon.3 Reviewed by: theraven Approved by: gabor (mentor)
* libc: Reduce relative relocations in strftime().jilles2012-06-171-1/+1
|
* Implement xlocale APIs from Darwin, mainly for use by libc++. This adds atheraven2011-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)
* strptime(3) confused July with June with the fr_FR locale.edwin2010-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
* Split the contributed code from libc/stdtime from lib/libc/stdtimeedwin2010-02-269-3620/+4
| | | | to contrib/tzcode/stdtime.
* %U was macroized in mdoc(7), escape.ru2010-02-161-1/+1
|
* Use _pthread_once() rather than _once() for localtime() and gmtime(). Thesejhb2010-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
* Use _once() to initialize the pthread key for thread-local storage to holdjhb2009-12-301-14/+14
| | | | | | the results of gmtime() instead of using a pthread mutex directly. MFC after: 1 week
* MFV of tzdata2009t, r200831edwin2009-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
* Use _once() to initialize the pthread key for thread-local storage to holdjhb2009-12-211-14/+14
| | | | | | the results of localtime() instead of using a pthread mutex directly. MFC after: 1 week
* Replace gmt_is_set and the gmt_mutex lock with a pthread_once_t variable andjhb2009-11-201-12/+13
| | | | | | an init routine run on the first invocation via _once(). MFC after: 1 week
* Improve the way failure of pthread_key_create() gets detected.edwin2009-09-141-2/+9
| | | | | | PR: threads/138603 Submitted by: Mikulas Patocka MFC after: 1 week
* Use (unsigned char) cast for ctype macroache2009-09-021-1/+1
|
* Implement %z for strptime.delphij2009-06-251-0/+28
| | | | | | PR: kern/63064 Submitted by: Stefan `Sec` Zehl <sec 42 org> (with some small changes) MFC after: 1 month
* Remove duplicate if-statement on gmt_is_set in gmtsub().edwin2009-06-231-8/+6
| | | | MFC after: 1 week
* Spacing fixes. No actual change.delphij2009-06-091-2/+2
|
* MFV of tzcode2009h revision r192887edwin2009-05-271-1/+1
| | | | | | - Clarify the license for the tzcode: public domain MFC after: 1 month
* MFV of tzcode2009e:edwin2009-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
* Pass a pointer to warn2 so the warn2 == IN_ALL would not be andelphij2008-10-301-1/+1
| | | | always-false condition.
* Clarify that "ante meridiem" and "post meridiem" mean the same thinggrog2008-05-161-2/+2
| | | | | | | | as the more commonly used "a.m." and "p.m.". Tripped over by: Callum Gibson. MFC after: 2 weeks
* Normally, we are often reading local time rather than setting time zone,davidxu2008-04-011-22/+63
| | | | | replace mutex with rwlock, this should eliminate lock contention in most cases.
* Reduce lock contention for simple cases.imp2007-12-191-16/+22
| | | | | | # this really should be done with pthread_once, but I've debugged this code. Reviewed by: arch@
* Some libc symbol map cleanups.deischen2007-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
* Use C comments since we now preprocess these files with CPP.deischen2007-04-291-1/+3
|
* On FreeBSD/arm, any value > 50 bits will result in a rediculously hugeimp2007-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.
* Per Regents of the University of Calfornia letter, remove advertisingimp2007-01-092-8/+0
| | | | | | clause. # If I've done so improperly on a file, please let me know.
* add a missing the...jmg2006-12-191-1/+1
| | | | MFC after: 3 days
* Add each directory's symbol map file to SYM_MAPS.deischen2006-03-131-0/+2
|
* Add symbol maps and initial symbol version definitions to libc.deischen2006-03-131-0/+34
| | | | Reviewed by: davidxu
* The arguments for time2posix() and posix2time() are time_t values, notstefanf2005-09-111-3/+3
| | | | pointers.
* Fix all the spelling mistakes I could find in the man pages for wordskeramida2005-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.
* Expand contractions.ru2005-02-131-1/+1
|
* Expand *n't contractions.ru2005-02-131-1/+1
|
* Sort sections.ru2005-01-201-5/+5
|
* Scheduled mdoc(7) sweep.ru2005-01-111-8/+10
|
* Add glibc-style strftime(3) padding specifiers, namely, -(no padding),delphij2004-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
* struct tm.tm_year is listed as 'years since 1900', and is signed. Onpeter2004-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)
* Mechanically kill hard sentence breaks.ru2004-07-023-3/+6
|
* Merge changes from the tzcode2004a import. Wherever possible I tried to bringstefanf2004-06-145-151/+374
| | | | | | us closer to the vendor branch. Requested by: wollman
* Remove a stale reference to %Ef and %EF from a comment.stefanf2004-06-131-2/+2
|
* Change defualt time zone from GMT to UTC. This will not be MFC-ed, andkensmith2004-06-111-1/+6
| | | | was done before 5-STABLE on purpose...
OpenPOWER on IntegriCloud