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.
This refactors the internal usages of the current time.
php_time.h
to be used instead of systemtime.h
php_realtime_get
andphp_realtime_spec
as a wrapper aroundclock_gettime
,timespec_get
,gettimeofday
andtime
using the realtime clockphp_monotime_fallback
either pointing tozend_hrtime
or wrappingphp_realtime_spec
timeval
andtimespec
php_*
timespec
for current time but keeptimeval
for timeoutsAs a result:
php_realtime_get
will be available for sure because it falls backclock_gettime
->timespec_get
->gettimeofday
->time
long
oftimeval.tv_sec
should be fixed time() and friends have Y2038 problem on 64 Windows #17856microtime()
/gettimeofday(true)
without BC breakuniqid
refactored a bit to not wait for the next time but increments if the current time is less or equal to the previous call. This should be faster and resolve a theoretical issue if the real time got modified in between (ntp)Even thought
gettimeofday
may not be available it wasn't checked everywhere before and compiling would have been failed already if missing. Availability should now be checked but as it falls back and it must have been available before I removed the conditions aroundmicrotime
,gettimeofday
anduniqid
PS: It's not fully refactored yet but a general pre-review would be welcome.