parsedate: refactor and 64-bit math adjustments#21394
Conversation
- introduce 'struct when' to hold the parser result - initwhen() initializes a 'struct when' - datestring() parses strings - datenum() parses numbers - datecheck() does some final checks - tzadjust() adds the time zone offset - convert math to 64 bit, squeeze into time_t only in the last step, mktimet() does the time_t storing
There was a problem hiding this comment.
Pull request overview
Refactors the date parsing implementation in lib/parsedate.c to use a structured “when” representation and to route calculations through curl_off_t, aiming to improve clarity and handling of wider time ranges.
Changes:
- Introduces
struct whenand splits parsing into helper functions (datestring,datenum,datecheck,tzadjust,mktimet). - Changes the epoch calculation path to operate on
curl_off_tseconds before converting totime_t. - Updates
tests/libtest/lib517.cto gate the post-Y2038 second on 64-bittime_t.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/libtest/lib517.c | Adjusts Y2038-related test gating for 64-bit time_t. |
| lib/parsedate.c | Refactors parsing and time math to use struct when + curl_off_t intermediate seconds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
augment review |
🤖 Augment PR SummarySummary: Refactors Changes:
Technical Notes: The parser now treats non-alphanumeric characters as separators, and performs final range decisions in 🤖 Was this summary useful? React with 👍 or 👎 |
No description provided.