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
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.
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
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
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
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
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
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
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
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.
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
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)
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
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
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
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.