Conversation
As code checks `curltime` values for zero and interprets this as not-initialized or "forever" in several places, make sure `curlx_now()` never returns a zero timestamp.
|
Analysis of PR #21034 at 07818a46: Test 2050 failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them). Generated by Testclutch |
bagder
approved these changes
Mar 20, 2026
Member
|
Better than #21028 ! |
outcast36
pushed a commit
to greearb/curl
that referenced
this pull request
Jun 3, 2026
As code checks `curltime` values for zero and interprets this as not-initialized or "forever" in several places, make sure `curlx_now()` never returns a zero timestamp. Closes curl#21034
vszakats
added a commit
to libssh2/libssh2
that referenced
this pull request
Jul 19, 2026
To honor the actual millisecond timeout set via `libssh2_session_set_timeout()`, to open the possibility for the same in other APIs, and to use monotonic time if available. - add internal abstract time types and macros for handling point in time and time intervals, and use them throughout the codebase. - bump internal abstract time resolution to milliseconds (from seconds). Use signed 64-bit integers. - replace existing millisecond-resolution code in `libssh2_poll()` with the internal abstract time interface. - bump 'now' function to retrieve millisecond-resolution monotonic time from the system, if available. Also: - append `_s` or `_ms` to public API arguments to tell the time unit. - keepalive: minor tidy-ups. - make `ssh2_now()` return at least 1 in the fallback, `time(NULL)`-based codepath to not confuse a zero value with unset time. Credits: Stefan Eissing Ref: curl/curl@5649b21 Ref: curl/curl#21034 - this leaves existing `ssh2_gettimeofday()` (together with its Windows-specific local implementation) with a single caller, `ssh2_deb_low()`. Refs: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html https://www.man7.org/linux/man-pages/man3/clock_gettime.3.html https://pubs.opengroup.org/onlinepubs/009604599/functions/gettimeofday.html https://www.man7.org/linux/man-pages/man2/gettimeofday.2.html https://learn.microsoft.com/windows/win32/api/profileapi/nf-profileapi-queryperformancefrequency https://learn.microsoft.com/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter https://stackoverflow.com/questions/5404277/porting-clock-gettime-to-windows Reported-and-patch-proposal-by: Trzik on github Based-on-patch-proposals-by: Ryan Kelley Fixes #1497 Ref: #1818 Closes #1893 Follow-up to 772abc7 #1919 Closes #2341
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As code checks
curltimevalues for zero and interprets this as not-initialized or "forever" in several places, make surecurlx_now()never returns a zero timestamp.