[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
PR/47916 CVS commit: [netbsd-6] src
The following reply was made to PR lib/47916; it has been noted by GNATS.
From: "SAITOH Masanobu" <msaitoh%netbsd.org@localhost>
Subject: PR/47916 CVS commit: [netbsd-6] src
Date: Fri, 17 Apr 2015 10:24:10 +0000
Module Name: src
Committed By: msaitoh
Date: Fri Apr 17 10:24:09 UTC 2015
src/lib/libutil [netbsd-6]: parsedate.3 parsedate.y
src/tests/lib/libutil [netbsd-6]: t_parsedate.c
Pull up following revision(s) (requested by nonaka in ticket #1291):
tests/lib/libutil/t_parsedate.c: revision 1.4-1.13
lib/libutil/parsedate.y: revision 1.14-1.20
lib/libutil/parsedate.3: revision 1.11-1.14
Distinguish between a non-error result of (time_t)-1 and an error result.
Modernise the test code inside #ifdef TEST.
fix timezone bugs in rev.1.11 and rev.1.13. PR/47916.
Some years don't need the "maybe add 1900 or 2000" adjustment
that was designed for handling two-digit abbreviated years.
For example, "1/2/70" still refers to the year 1970, as before,
but "70-01-02" now refers to the year 70.
* Add a new yyHaveFullYear member to struct dateinfo, to record whether
or not the year needs to be adjusted.
* Code that parses years sets yyHaveFullYear=1 if they know that the
year should not be adjusted (as is the case for ISO 8601 dates), or if
they perform their own adjustment (as is the case for CVS timestamps).
* Move the year adjustment code into a new function, AdjustYear,
instead of inline in Convert().
* Make Convert() assume the year doesn't need to be adjusted,
and make Convert's callers first call AdjustYear() if appropriate.
A time like HH:MM:SS.sss says nothing about whether DST is on or off.
Add a new non-terminal "time_numericzone" for a time with
a numeric timezone. Move some productions from "time" to "time_numericzone".
Increment yyHaveZone when encountering one of these.
Previously, input of the form "HH:MM:SS +ZZZZ" would not have set the
Improved handling of local times.
* A magic value USE_LOCAL_TIME (defined as 99999) may be passed as the
Timezone to Convert(), instructing it to use mktime() to work
in the local time zone, instead of using mktime_z to work in UTC
(and then adding the specified timezone offset).
* Some old code is removed now that there's no need to find the local
* Allow either one or both of the now and zone arguments to
parsedate() to be NULL, treating them independently. Previously,
if either one was NULL, the other was ignored.
* If the zone argument is specified, then the current date is calculated
in the specified zone, not in local time.
Also add some disabled debug code.
This should fix PR lib/47916.
Fix capitalization and typo, from Bug Hunting.
Document that errno may be used to distinguish between a
non-error result of -1 and an error.
Document that years in ISO 8601 dates are taken literally.
"69-09-10" is in the year 69, not 2069.
The tzoff argument is in minutes (behind/west of UTC), not seconds.
While here, also say that time = NULL and tzoff = NULL are independent.
The code doesn't yet implement that, but it will soon.
mention the PR# in the description like everyone else.
To be on the safe side, use the category/number notation when referring to
PRs (otherwise third-party sed-scripts might miss the references). Also
* Test that parsedate("@0", ...) returns (time_t)0 regardless of timezone.
* Test that parsedate("@-1", NULL, NULL) returns (time_t)-1
without setting errno.
Test parsedate("@-2",...) (should return -2 and not set errno);
and parsedate("@junk",...) (should return -1 and set errno).
We were already testing "@-1".
Add local parsecheck() function and use it for several tests.
Instead of just checking that parsedate(3) does not return an error,
also pass the result through localtime_r(3) or gmtime_r(3) and check the
year/month/day/hour/minute/second fields in the resulting struct tm.
Add comments for some non-obvious cases.
Also add a test with year=70, which is documented to be treated as 1970.
Adapt to a recent change in parsedate().
"9/10/69" still refers to 2069, and "9/10/70" still refers to 1970,
but "69-09-10" and "70-09-10" now refer to the years 69 and 70.
Add tests for PR lib/47916. Some of these fail.
When tests fail, print all args, notjust the date string.
2013-07-09 was in British Summer TIme, so use tzoff=-60, not 0.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r188.8.131.52 src/lib/libutil/parsedate.3
cvs rdiff -u -r184.108.40.206 -r220.127.116.11 src/lib/libutil/parsedate.y
cvs rdiff -u -r1.3 -r18.104.22.168 src/tests/lib/libutil/t_parsedate.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Main Index |
Thread Index |