]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
strptime: fix parsing of tm_year when both %C and %y appear in the
authoryuripv <yuripv@FreeBSD.org>
Wed, 17 Oct 2018 14:51:43 +0000 (14:51 +0000)
committeryuripv <yuripv@FreeBSD.org>
Wed, 17 Oct 2018 14:51:43 +0000 (14:51 +0000)
commita6e075a2c40be1745f1ae0b9ba210ce06438179d
tree97997f33646c06910937e14acd61336be7c2f3a7
parentad5fefcc732a9ddcc80c4728f410a32e2425bcdc
strptime: fix parsing of tm_year when both %C and %y appear in the
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
lib/libc/stdtime/strptime.c