Added tests for invalid dates like the following
Date 1970-01-01 00:00:-1 is treated as 1969-12-31 23:59:59 and seconds are returned for the modified date.
Tested the code by doing ninja check-libc (and cmake).
Paths
| Differential D96684
Changes to mktime to handle invalid dates, overflow and underflow andcalculating the correct date and thenumber of seconds even if invalid datesare passed as arguments. ClosedPublic Authored by rtenneti on Feb 14 2021, 8:57 PM.
Details Summary Added tests for invalid dates like the following Date 1970-01-01 00:00:-1 is treated as 1969-12-31 23:59:59 and seconds are returned for the modified date. Tested the code by doing ninja check-libc (and cmake).
Diff Detail
Event Timelinertenneti retitled this revision from Changes to mktime to handle invalid dates, overflow and underflow and
calculating the correct date and thenumber of seconds even if invalid dates
are passed as arguments. to Changes to mktime to handle invalid dates, overflow and underflow andcalculating the correct date and thenumber of seconds even if invalid datesare passed as arguments..Feb 16 2021, 10:15 AM
Comment Actions Please run clang-format if you have not already done so.
This revision is now accepted and ready to land.Feb 19 2021, 8:42 PM rtenneti marked 3 inline comments as done. Comment ActionsFixed comments - Deleted check_mktime function and replaced it Comment Actions arc diff command ran Lint and clang-format and fixed the formatting.
Auto-Fix (S&RX) Lint clang-format suggested style edits found: Closed by commit rG034f5629256c: Changes to mktime to handle invalid dates, overflow and underflow… (authored by rtenneti). · Explain WhyFeb 22 2021, 6:38 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 325636 libc/src/time/CMakeLists.txt
libc/src/time/mktime.cpplibc/src/time/time_utils.h
libc/test/src/time/CMakeLists.txt
libc/test/src/time/TmMatcher.h
libc/test/src/time/mktime_test.cpp
|
You can probably move these constants also to the class TimeConstants suggested above..