You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
time() and friends have Y2038 problem on 64 Windows #17856
Wow, serious mess here. While we're checking for the availability of gettimeofday() during configuration, setting HAVE_GETTIMEOFDAY if so, in a couple of places we just call the function even though it might not be available. Sometimes we check whether the gettimeofday() call failed, and sometimes we just assume it cannot fail. As fallback we're using time(), but still prefer gettimeofday() even when we don't use the microseconds.
@cmb69 I was trying to refactor the internally used time API and come up with a simple wrapper.
It's basically a function providing the current time and used either timespec_get or clock_gettime or gettimeofdayor just time depending on what is available.
Do you think this would be the right way of doing it?
Activity
ndossche commentedon Feb 18, 2025
A bit related to #14141
cmb69 commentedon Feb 18, 2025
Wow, serious mess here. While we're checking for the availability of
gettimeofday()during configuration, settingHAVE_GETTIMEOFDAYif so, in a couple of places we just call the function even though it might not be available. Sometimes we check whether thegettimeofday()call failed, and sometimes we just assume it cannot fail. As fallback we're usingtime(), but still prefergettimeofday()even when we don't use the microseconds.And those calls to
gettimeofday()are spread all over the place.cmb69 commentedon Feb 18, 2025
Oh, forg
eot: instead of usingclock_gettime()we can likely usetimespec_get()which is a C11 function.marc-mabe commentedon Jul 17, 2025
@cmb69 I was trying to refactor the internally used time API and come up with a simple wrapper.
It's basically a function providing the current time and used either
timespec_getorclock_gettimeorgettimeofdayor justtimedepending on what is available.Do you think this would be the right way of doing it?
The branch is here https://github.com/marc-mabe/php-src/tree/current_time_wrapper
PS: I'm completely unsure about the code structure right now.