-
Notifications
You must be signed in to change notification settings - Fork 36.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assert now > 0 in GetTime GetTimeMillis GetTimeMicros #7094
Conversation
Previously all of these functions could return negative values (for different readons). Large portions of the codebase currently assume that these functions return positive values.
(Besides if your time is before 1970-1-1 you will reject every single block as being too far in the future) |
Sure? Concept ACK. |
@dcousens I was reviewing another PR and noticed that it (sort of) relied on this behavior. Went and looked a bit and noticed basically every caller does. |
utACK |
Anything concerning time deltas is a different issue. I certainly think a monotonic clock would be useful for some measurements (such as pings). However this code change would just make sure that the absolute time is positive. More of a sanity check of the OS and boost (eg time() returns -1 on error). |
utACK |
In what cases do we expect these assertions to fail? |
IIUIC, it is only for "just to be sure". E.g. on Linux kernel, you can't make ACK |
@paveljanik I guess time() could fail if the relevant syscall is somehow blocked off, say, through seccomp_bpf. And yes boost... who knows |
1bb289f Assert now > 0 in GetTime GetTimeMillis GetTimeMicros (Patick Strateman)
Previously all of these functions could return negative values (for different readons). Large portions of the codebase currently assume that these functions return positive values. Github-Pull: bitcoin#7094 Rebased-From: 1bb289f
Previously all of these functions could return negative values (for different readons). Large portions of the codebase currently assume that these functions return positive values. Github-Pull: bitcoin#7094 Rebased-From: 1bb289f
Previously all of these functions could return negative values (for different
readons). Large portions of the codebase currently assume that these
functions return positive values.