The NetBSD Project

CVS log for src/lib/libutil/parsedate.y

[BACK] Up to [cvs.NetBSD.org] / src / lib / libutil

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.37 / (download) - annotate - [select for diffs], Sat Apr 23 13:02:04 2022 UTC (9 months, 1 week ago) by christos
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, HEAD
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

fix date -d 12/01/2022, found by Anon Ymous

Revision 1.36 / (download) - annotate - [select for diffs], Fri Oct 30 22:03:11 2020 UTC (2 years, 3 months ago) by kre
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.35: +139 -18 lines
Diff to previous 1.35 (colored)

PR lib/46542

Add checks to detect overflow, and also detect other invalid
(out of range) inputs for parsedate().

There could be more, and some of what is being added is not
perfect, but many calculation overflows will be detected now
(and cause an error return) and some of the most bizarre
inputs that were previously accepted no longer will be.

Revision 1.35 / (download) - annotate - [select for diffs], Mon Oct 19 17:47:45 2020 UTC (2 years, 3 months ago) by kre
Branch: MAIN
Changes since 1.34: +8 -5 lines
Diff to previous 1.34 (colored)

Check the year field of a tentative ISO-8601 date format for overflow
before committing to it being an 8601 format date, rather than after
(or the fall back grammar parser doesn't start with a clean slate).

This isn't likely to ever bother anyone, the chances of encountering
something that looks just like an 8601 format date, but with a year
field so large it overflows a long are kind of slim.   If it did happen
the chances that the string could be correctly parsed (into something
different) by the grammar are even slimmer. But better to do it properly.

Revision 1.34 / (download) - annotate - [select for diffs], Mon Oct 19 15:08:17 2020 UTC (2 years, 3 months ago) by kre
Branch: MAIN
Changes since 1.33: +86 -1 lines
Diff to previous 1.33 (colored)

For touch -d (which uses parsedate()) POSIX specifies that the
ISO-8601 format yyyy-mm-ddTHH:MM:SS[radix_and+frac][Z]
be accepted.

We didn't handle that, as in parsedate(), 'T' represents the
military timezone designator, not a padding separator between
date & time as POSIX specified it.

The way parsedate() is written, fixing this in the grammar/lexer
would be hard without deleting support for T as a zone indicator
(it is *my* timezone!).

So, instead of doing that, parse an ISO-8901 string which occurs
right at the start of the input (not even any preceding white space)
by hand, before invoking the grammar, and so not involving the lexer.
This is sufficient to make touch -d conform.

After doing that, we still need to allow earlier valid inputs,
where an ISO-8601 format (using space as the separator, but without
the 'Z' (Zulu, or UTC) suffix) followed by an arbitrary timezone
designation, and other modifiers (eg: "+5 minutes" work.  So we
call the grammar on whatever is left of the input after the 8601
string has been consumed.   This all "just works" with one exception,
a format like "yyyy-mm-dd hh:mm:ss +0700" would have the grammar parse
just "+0700" which by itself would be meaningless, and so wasn't
handled.    Add a grammar rule & processing to Handle it.

Also note that while POSIX specifies "at least 4" digits in the YYYY
field, we implement "at least one" so years from 0-999 continue to be
parsed as they always have (nb: these were, and continue to be, treated
as absolute year numbers, year 10 is year 10, not 2010).  Years > 2 billion
(give or take) cannot be represented in the tm_year field of a struct tm,
so there's a limit on the max number of digits as well.

Revision 1.33 / (download) - annotate - [select for diffs], Mon Oct 19 15:05:53 2020 UTC (2 years, 3 months ago) by kre
Branch: MAIN
Changes since 1.32: +12 -4 lines
Diff to previous 1.32 (colored)

POSIX requires that when converting 2 digit year representations to
actual specific years, values from 69-99 be treated as 20th century,
and values from 0-68 be treated as 21st century.  This allows for those
unfortunate enough to reside in a timezone west of Greenwich to convert
the epoch (or a time very close to it) to text, write that with just two
digits, and correctly convert it back to a time near the epoch, rather
than to something in 2069.

We used to split things so 0-69 were 21st century, and 70-99 were 20th.
Change that (this requires a change in the parsedate ATF tests which
test this specific boundary).

While here, add support for another POSIX requirement, that the radix
char before fractional seconds can be either a ',' or a '.'.  We used
to allow only '.', add support for ','.   This is something of a meaningless
change, as parsedate() returns a time_t in which there is no way to
represent fractional seconds, so there's little point in ever specifying
them regardless of what char is used for the "decimal point" - they will
be ignored anyway.    But at least fractional seconds using a ',' as the
radix char will no longer cause the conversion to fail (or do something else
bizarre).

Revision 1.29.2.1 / (download) - annotate - [select for diffs], Wed Apr 26 02:52:57 2017 UTC (5 years, 9 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.29: +63 -14 lines
Diff to previous 1.29 (colored) next main 1.30 (colored)

Sync with HEAD

Revision 1.29.4.1 / (download) - annotate - [select for diffs], Fri Apr 21 16:53:12 2017 UTC (5 years, 9 months ago) by bouyer
Branch: bouyer-socketcan
Changes since 1.29: +63 -14 lines
Diff to previous 1.29 (colored) next main 1.30 (colored)

Sync with HEAD

Revision 1.32 / (download) - annotate - [select for diffs], Wed Mar 22 18:17:42 2017 UTC (5 years, 10 months ago) by kre
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, phil-wifi, pgoyette-localcount-20170426, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, is-mlppp-base, is-mlppp, bouyer-socketcan-base1
Changes since 1.31: +5 -4 lines
Diff to previous 1.31 (colored)


parsedate.y:  meaningless KNF of a comment (no code changes)
parsedate.3:  add an item in BUGS noting the weirdness of "next"

The real purpose of this commit is to supply the following message
which should be used for the immediately previous commit, replacing
its commit message (the two are similar, but definitely not the
same).   With thanks to gdt@ for pointing out one of the (many) errors
in the previous message (and noting others I had already seen).

    ----

Make parsedate handle "12 noon" and "12 midnight" (including when the
time given is "12:00" or "12:00:00") - but only for exactly 12 o'clock.
"12:00:01" is am or pm, not noon or midnight.

"12 am" remains as an alias for "12 midnight", and "12 pm" for noon,
though both are strictly (pedanticly) invalid (and meaningless.)

Note that "12 midnight" (or "12 am") means 00:00:00 (ie: midnight at
the start of the day, not at the end.)

Revision 1.31 / (download) - annotate - [select for diffs], Wed Mar 22 01:49:36 2017 UTC (5 years, 10 months ago) by kre
Branch: MAIN
Changes since 1.30: +56 -10 lines
Diff to previous 1.30 (colored)


Make parsedate handle "12 noon" and "12 midnight" (including when
the time is "12:00" or "12:00:00) - but only for exactly 12 o'clock.
"12:00:01" is am or pm, not noon or midnight.

"12 am" remains as an alias for "12 midnight", and "12 pm" for midnight,
though both are strictly invalid (and meaningless.)

Note that "12 pm" means 00:00:00 (ie: midnight at the start of the
day, not at the end.)

Revision 1.30 / (download) - annotate - [select for diffs], Wed Mar 22 00:59:06 2017 UTC (5 years, 10 months ago) by kre
Branch: MAIN
Changes since 1.29: +4 -2 lines
Diff to previous 1.29 (colored)


Fix PR lib/52101 -- 12:30 am is 00:30:00 and 12:30 pm is 12:30:00

Revision 1.29 / (download) - annotate - [select for diffs], Sun Jun 26 07:09:24 2016 UTC (6 years, 7 months ago) by kre
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, localcount-20160914, bouyer-socketcan-base
Branch point for: pgoyette-localcount, bouyer-socketcan
Changes since 1.28: +1 -5 lines
Diff to previous 1.28 (colored)


Remove dawn/sunup/sunset/sundown (sunrise was never there...)
If 06:00 or 18:00 are wanted, just say "06:00" (etc).  If these
are ever added back, they really should determine location, and
calculate actual sunrise/sunset times for the location and date.
That's not likely to happen...

Revision 1.28 / (download) - annotate - [select for diffs], Tue May 3 18:14:54 2016 UTC (6 years, 9 months ago) by kre
Branch: MAIN
Changes since 1.27: +62 -22 lines
Diff to previous 1.27 (colored)


Make relative date changes ("+ 2 months") etc, work a little more sanely.

OK christos@

Revision 1.27 / (download) - annotate - [select for diffs], Thu Dec 31 10:52:06 2015 UTC (7 years, 1 month ago) by dholland
Branch: MAIN
Changes since 1.26: +19 -7 lines
Diff to previous 1.26 (colored)

When computing relative months, use mktime() directly and don't call
our Convert(). And check it for failure. This fixes three sets of
problems:

  (1) depending on the passed-in value of Timezone it might
      disassemble the time in one timezone and reassemble it in
      another, causing mysterious offsets of a few hours;

  (2) with the previous set of changes to this file, Convert() fails
      if it ends up normalizing a date, so e.g. going three months
      forward from March 31 would fail;

  (3) previously if Convert() failed we passed -1 on to DSTcorrect(),
      which made a mess.

PR 50574.

Revision 1.26 / (download) - annotate - [select for diffs], Thu Dec 31 10:31:07 2015 UTC (7 years, 1 month ago) by dholland
Branch: MAIN
Changes since 1.25: +13 -15 lines
Diff to previous 1.25 (colored)

Always use localtime_r; I don't think any of this code is tripping
itself up, but it's still good practice for library functions to not
trash static libc state. Might be relevant to PR 50574.

Revision 1.25 / (download) - annotate - [select for diffs], Thu Dec 31 09:12:57 2015 UTC (7 years, 1 month ago) by dholland
Branch: MAIN
Changes since 1.24: +224 -260 lines
Diff to previous 1.24 (colored)

Reformat grammar part according to my standards for yacc grammars.

Revision 1.24 / (download) - annotate - [select for diffs], Tue Dec 8 12:51:04 2015 UTC (7 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.23: +3 -1 lines
Diff to previous 1.23 (colored)

preserve a copy of the tm so we can check later.

Revision 1.23 / (download) - annotate - [select for diffs], Mon Dec 7 20:55:49 2015 UTC (7 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.22: +46 -5 lines
Diff to previous 1.22 (colored)

- Add support for "midnight" "noon", dawn etc.
- Add validation to date/time strings by checking that mktime did not change
  the fields of struct tm from the ones requested
- Allow the format "year monthname day".
From kre

Revision 1.22 / (download) - annotate - [select for diffs], Sun Dec 6 14:43:59 2015 UTC (7 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.21: +5 -5 lines
Diff to previous 1.21 (colored)

Fix west australia offset, from kre

Revision 1.21 / (download) - annotate - [select for diffs], Thu Nov 26 01:00:02 2015 UTC (7 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.20: +41 -21 lines
Diff to previous 1.20 (colored)

Patch from kre:
- fix missing/inconsistent abbreviations
- set dst only if we are using localtime.
- properly check for errors where there were missing checks
- handle errno properly including saving and restoring.

Revision 1.11.2.2 / (download) - annotate - [select for diffs], Fri Apr 17 10:24:09 2015 UTC (7 years, 9 months ago) by msaitoh
Branch: netbsd-6
Changes since 1.11.2.1: +120 -90 lines
Diff to previous 1.11.2.1 (colored) to branchpoint 1.11 (colored) next main 1.12 (colored)

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.
add rcsid
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
yyhaveZone flag.
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
  timezone offset.
* 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
remove white-space.
* 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.

Revision 1.16.6.4 / (download) - annotate - [select for diffs], Sat Oct 11 16:56:21 2014 UTC (8 years, 3 months ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Changes since 1.16.6.3: +37 -45 lines
Diff to previous 1.16.6.3 (colored) to branchpoint 1.16 (colored) next main 1.17 (colored)

Pull up following revision(s) (requested by apb in ticket #135):
	lib/libutil/parsedate.y: revision 1.20
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
  timezone offset.
* 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.

Revision 1.16.6.3 / (download) - annotate - [select for diffs], Sat Oct 11 16:51:23 2014 UTC (8 years, 3 months ago) by snj
Branch: netbsd-7
Changes since 1.16.6.2: +18 -12 lines
Diff to previous 1.16.6.2 (colored) to branchpoint 1.16 (colored)

Pull up following revision(s) (requested by apb in ticket #135):
	lib/libutil/parsedate.y: revision 1.19
Previously, input of the form "HH:MM:SS +ZZZZ" would not have set the
yyhaveZone flag.

Revision 1.16.6.2 / (download) - annotate - [select for diffs], Sat Oct 11 16:47:48 2014 UTC (8 years, 3 months ago) by snj
Branch: netbsd-7
Changes since 1.16.6.1: +1 -3 lines
Diff to previous 1.16.6.1 (colored) to branchpoint 1.16 (colored)

Pull up following revision(s) (requested by apb in ticket #135):
	lib/libutil/parsedate.y: revision 1.18
A time like HH:MM:SS.sss says nothing about whether DST is on or off.

Revision 1.16.6.1 / (download) - annotate - [select for diffs], Sat Oct 11 16:44:31 2014 UTC (8 years, 3 months ago) by snj
Branch: netbsd-7
Changes since 1.16: +41 -23 lines
Diff to previous 1.16 (colored)

Pull up following revision(s) (requested by apb in ticket #135):
	lib/libutil/parsedate.y: revision 1.17
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.

Revision 1.20 / (download) - annotate - [select for diffs], Wed Oct 8 17:38:28 2014 UTC (8 years, 3 months ago) by apb
Branch: MAIN
Changes since 1.19: +37 -45 lines
Diff to previous 1.19 (colored)

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
  timezone offset.
* 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.

Revision 1.19 / (download) - annotate - [select for diffs], Wed Oct 8 14:43:48 2014 UTC (8 years, 3 months ago) by apb
Branch: MAIN
Changes since 1.18: +18 -12 lines
Diff to previous 1.18 (colored)

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
yyhaveZone flag.

Revision 1.18 / (download) - annotate - [select for diffs], Wed Oct 8 14:32:29 2014 UTC (8 years, 3 months ago) by apb
Branch: MAIN
Changes since 1.17: +1 -3 lines
Diff to previous 1.17 (colored)

A time like HH:MM:SS.sss says nothing about whether DST is on or off.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Oct 7 22:27:14 2014 UTC (8 years, 3 months ago) by apb
Branch: MAIN
Changes since 1.16: +41 -23 lines
Diff to previous 1.16 (colored)

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.

Revision 1.10.6.6 / (download) - annotate - [select for diffs], Thu May 22 11:37:00 2014 UTC (8 years, 8 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.10.6.5: +7 -2 lines
Diff to previous 1.10.6.5 (colored) to branchpoint 1.10 (colored) next main 1.11 (colored)

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.11.6.3 / (download) - annotate - [select for diffs], Sun Jun 23 06:21:09 2013 UTC (9 years, 7 months ago) by tls
Branch: tls-maxphys
Changes since 1.11.6.2: +7 -2 lines
Diff to previous 1.11.6.2 (colored) to branchpoint 1.11 (colored) next main 1.12 (colored)

resync from head

Revision 1.16 / (download) - annotate - [select for diffs], Wed Jun 12 01:46:07 2013 UTC (9 years, 7 months ago) by yamt
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-7-base
Branch point for: netbsd-7
Changes since 1.15: +3 -3 lines
Diff to previous 1.15 (colored)

fix timezone bugs in rev.1.11 and rev.1.13.  PR/47916.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jun 12 01:31:24 2013 UTC (9 years, 7 months ago) by yamt
Branch: MAIN
Changes since 1.14: +5 -0 lines
Diff to previous 1.14 (colored)

add rcsid

Revision 1.10.6.5 / (download) - annotate - [select for diffs], Wed Jun 12 01:30:21 2013 UTC (9 years, 7 months ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.10.6.4: +0 -5 lines
Diff to previous 1.10.6.4 (colored) to branchpoint 1.10 (colored)

revert the previous (wrong branch)

Revision 1.10.6.4 / (download) - annotate - [select for diffs], Wed Jun 12 01:09:33 2013 UTC (9 years, 7 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.10.6.3: +5 -0 lines
Diff to previous 1.10.6.3 (colored) to branchpoint 1.10 (colored)

add rcsid

Revision 1.11.6.2 / (download) - annotate - [select for diffs], Mon Feb 25 00:28:01 2013 UTC (9 years, 11 months ago) by tls
Branch: tls-maxphys
Changes since 1.11.6.1: +29 -15 lines
Diff to previous 1.11.6.1 (colored) to branchpoint 1.11 (colored)

resync with head

Revision 1.11.8.1 / (download) - annotate - [select for diffs], Fri Feb 8 20:30:43 2013 UTC (9 years, 11 months ago) by riz
Branch: netbsd-6-0
CVS Tags: netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE
Changes since 1.11: +6 -3 lines
Diff to previous 1.11 (colored) next main 1.12 (colored)

Pull up following revision(s) (requested by apb in ticket #791):
	lib/libutil/parsedate.y: revision 1.13
mktime(3) works in local time, and trying to trick it by
setting tm_gmtoff doesn't work.  Instead, call mktime_z(3)
with a null timezone (so it works in UTC) and adjust the
result afterwards.  Now "date -d @0" correctly
prints the local equivalent of 1970-01-01 00:00:00 UTC.

Revision 1.11.2.1 / (download) - annotate - [select for diffs], Fri Feb 8 20:30:34 2013 UTC (9 years, 11 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1
Changes since 1.11: +6 -3 lines
Diff to previous 1.11 (colored)

Pull up following revision(s) (requested by apb in ticket #791):
	lib/libutil/parsedate.y: revision 1.13
mktime(3) works in local time, and trying to trick it by
setting tm_gmtoff doesn't work.  Instead, call mktime_z(3)
with a null timezone (so it works in UTC) and adjust the
result afterwards.  Now "date -d @0" correctly
prints the local equivalent of 1970-01-01 00:00:00 UTC.

Revision 1.10.6.3 / (download) - annotate - [select for diffs], Wed Jan 23 00:05:27 2013 UTC (10 years ago) by yamt
Branch: yamt-pagecache
Changes since 1.10.6.2: +29 -15 lines
Diff to previous 1.10.6.2 (colored) to branchpoint 1.10 (colored)

sync with head

Revision 1.14 / (download) - annotate - [select for diffs], Sat Jan 19 15:23:33 2013 UTC (10 years ago) by apb
Branch: MAIN
CVS Tags: yamt-pagecache-base8, agc-symver-base, agc-symver
Changes since 1.13: +23 -12 lines
Diff to previous 1.13 (colored)

Distinguish between a non-error result of (time_t)-1 and an error result.
Modernise the test code inside #ifdef TEST.

Revision 1.13 / (download) - annotate - [select for diffs], Sat Jan 19 09:27:32 2013 UTC (10 years ago) by apb
Branch: MAIN
Changes since 1.12: +6 -3 lines
Diff to previous 1.12 (colored)

mktime(3) works in local time, and trying to trick it by
setting tm_gmtoff doesn't work.  Instead, call mktime_z(3)
with a null timezone (so it works in UTC) and adjust the
result afterwards.  Now "date -d @0" correctly
prints the local equivalent of 1970-01-01 00:00:00 UTC.

Revision 1.11.6.1 / (download) - annotate - [select for diffs], Tue Nov 20 03:00:45 2012 UTC (10 years, 2 months ago) by tls
Branch: tls-maxphys
Changes since 1.11: +5 -5 lines
Diff to previous 1.11 (colored)

Resync to 2012-11-19 00:00:00 UTC

Revision 1.10.6.2 / (download) - annotate - [select for diffs], Tue Oct 30 18:59:19 2012 UTC (10 years, 3 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.10.6.1: +5 -5 lines
Diff to previous 1.10.6.1 (colored) to branchpoint 1.10 (colored)

sync with head

Revision 1.12 / (download) - annotate - [select for diffs], Thu Sep 13 21:44:50 2012 UTC (10 years, 4 months ago) by joerg
Branch: MAIN
CVS Tags: yamt-pagecache-base7, yamt-pagecache-base6
Changes since 1.11: +5 -5 lines
Diff to previous 1.11 (colored)

Don't use const foo const as type, one const is enough.

Revision 1.10.6.1 / (download) - annotate - [select for diffs], Tue Apr 17 00:05:34 2012 UTC (10 years, 9 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.10: +23 -100 lines
Diff to previous 1.10 (colored)

sync with head

Revision 1.11 / (download) - annotate - [select for diffs], Sat Dec 17 19:14:10 2011 UTC (11 years, 1 month ago) by apb
Branch: MAIN
CVS Tags: yamt-pagecache-base5, yamt-pagecache-base4, netbsd-6-base, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-1-RELEASE, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Branch point for: tls-maxphys, netbsd-6-0, netbsd-6
Changes since 1.10: +23 -100 lines
Diff to previous 1.10 (colored)

Use mktime(3) instead of hand-coded equivalent.
Don't treat negative results as errors (we should be able
to handle years before 1970).

XXX: This still fails on 1969-12-31 23:59:59.

Revision 1.10 / (download) - annotate - [select for diffs], Fri Dec 24 15:47:39 2010 UTC (12 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, matt-mips64-premerge-20101231, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Branch point for: yamt-pagecache
Changes since 1.9: +1 -1 lines
Diff to previous 1.9 (colored)

restore lost overlow check fix.

Revision 1.9 / (download) - annotate - [select for diffs], Fri Dec 24 03:37:37 2010 UTC (12 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.8: +223 -219 lines
Diff to previous 1.8 (colored)

make this thread-safe. We could use localtime_tz and make it even better,
but not now.

Revision 1.8 / (download) - annotate - [select for diffs], Tue Dec 21 18:13:02 2010 UTC (12 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.7: +1 -1 lines
Diff to previous 1.7 (colored)

fix incorrect overflow check from Nicholas Joly

Revision 1.7 / (download) - annotate - [select for diffs], Tue Dec 21 00:14:10 2010 UTC (12 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.6: +24 -2 lines
Diff to previous 1.6 (colored)

- fix off by one in comparison with 69 (it should be 70)
- add aliases for 1 (one), 2 (two), etc.
- allow parsing of HH:MM:SS.sss as the man page mentions, and ignore sss

Revision 1.6 / (download) - annotate - [select for diffs], Sun Dec 12 18:39:57 2010 UTC (12 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.5: +56 -21 lines
Diff to previous 1.5 (colored)

PR/42549: Izumi Tsutsui: parsedate does not work after 2038.
Fix multiple issues:
- Remove bogus 2038 check and add overflow checks in the appropriate places.
- Correct incomplete leap year calculation that broke things after 2100.
- Check localtime return values
- Change int calculations to time_t to avoid oveflow.
- Consistently check/return -1 and remove bogus comment about not being
  able to return -1.

Now:
$ date -d 20991201
Tue Dec  1 00:00:00 EST 2099
$ date -d 40991201
Tue Dec  1 00:00:00 EST 4099
$ date -d 10000000991201
Tue Dec  1 00:00:00 EST 1000000099
TIME=0:04.48 CPU=117.8% (5.288u 0.000s) SWAPS=0 (0+95)pf (0i+0o) (0Kc+0Kd)
$ date -d 100000000991201
date: Cannot parse `100000000991201'
TIME=0:53.48 CPU=99.2% (53.086u 0.000s) SWAPS=0 (0+96)pf (0i+0o) (0Kc+0Kd)
Exit 1

Revision 1.3.4.1 / (download) - annotate - [select for diffs], Sun Nov 21 20:38:38 2010 UTC (12 years, 2 months ago) by riz
Branch: netbsd-5
CVS Tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, matt-nb5-pq3-base, matt-nb5-pq3
Changes since 1.3: +35 -1 lines
Diff to previous 1.3 (colored) next main 1.4 (colored)

Pull up following revision(s) (requested by tron in ticket #1443):
	lib/libutil/parsedate.3: revision 1.7
	lib/libutil/parsedate.y: revision 1.5
Add support for parsing the data format "@<seconds since epoch>" e.g.
"@735275209" for "Tue Apr 20 03:06:49 UTC 1993". This change was inspired
by coreutil's "date" utility.
Mention recent enhancement and not that this function is neither
re-entrant nor thread-safe.

Revision 1.5 / (download) - annotate - [select for diffs], Sat Aug 21 16:17:40 2010 UTC (12 years, 5 months ago) by tron
Branch: MAIN
Changes since 1.4: +35 -1 lines
Diff to previous 1.4 (colored)

Add support for parsing the data format "@<seconds since epoch>" e.g.
"@735275209" for "Tue Apr 20 03:06:49 UTC 1993". This change was inspired
by coreutil's "date" utility.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jan 11 02:57:17 2009 UTC (14 years ago) by christos
Branch: MAIN
CVS Tags: matt-premerge-20091211, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend
Changes since 1.3: +0 -4 lines
Diff to previous 1.3 (colored)

merge christos-time_t

Revision 1.3.6.2 / (download) - annotate - [select for diffs], Mon Dec 29 17:02:18 2008 UTC (14 years, 1 month ago) by christos
Branch: christos-time_t
Changes since 1.3.6.1: +965 -0 lines
Diff to previous 1.3.6.1 (colored) to branchpoint 1.3 (colored) next main 1.4 (colored)

hide yacc symbols from parsedate. Broke other yacc applications.

Revision 1.2.12.1 / (download) - annotate - [select for diffs], Thu Sep 18 04:39:25 2008 UTC (14 years, 4 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.2: +1 -0 lines
Diff to previous 1.2 (colored) next main 1.3 (colored)

Sync with wrstuden-revivesa-base-2.

Revision 1.3.6.1, Thu Jul 17 16:24:55 2008 UTC (14 years, 6 months ago) by christos
Branch: christos-time_t
Changes since 1.3: +0 -969 lines
FILE REMOVED

file parsedate.y was added on branch christos-time_t on 2008-12-29 17:02:18 +0000

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jul 17 16:24:55 2008 UTC (14 years, 6 months ago) by drochner
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, netbsd-5-base, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2, christos-time_t-base
Branch point for: netbsd-5, christos-time_t
Changes since 1.2: +1 -0 lines
Diff to previous 1.2 (colored)

include <stdlib.h> explicitely, for exit(), getprogname() etc.
(it happens to be pulled in by the yacc skeleton, but we shouldn't
rely on this)

Revision 1.2 / (download) - annotate - [select for diffs], Wed Dec 20 16:47:13 2006 UTC (16 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-1, wrstuden-revivesa-base, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-nbase, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf
Branch point for: wrstuden-revivesa
Changes since 1.1: +1 -1 lines
Diff to previous 1.1 (colored)

From Anon Ymous:
- add __unused
- remove __GNUC__ hack

Revision 1.1 / (download) - annotate - [select for diffs], Mon Nov 20 20:33:02 2006 UTC (16 years, 2 months ago) by christos
Branch: MAIN
CVS Tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4

rename getdate to parsedate to avoid conflict with posix function

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>