Module Name: src Committed By: christos Date: Sun Dec 12 18:39:58 UTC 2010
Modified Files: src/lib/libutil: parsedate.y Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libutil/parsedate.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.