From: Aaron Schulz Date: Wed, 3 Oct 2018 22:01:29 +0000 (-0400) Subject: Make UID clock drift error have more details. X-Git-Tag: 1.34.0-rc.0~3909 X-Git-Url: http://git.cyclocoop.org/%27http:/code.google.com/p/ie7-js/Category:Bar2?a=commitdiff_plain;h=67670358407b4bb527d42b6059ce39cbd2402b2b;p=lhc%2Fweb%2Fwiklou.git Make UID clock drift error have more details. Change-Id: Ic682e48b06161c2a286f5da9016f4831ee72a31e --- diff --git a/includes/utils/UIDGenerator.php b/includes/utils/UIDGenerator.php index 52740c9952..4b5410e2f1 100644 --- a/includes/utils/UIDGenerator.php +++ b/includes/utils/UIDGenerator.php @@ -475,11 +475,12 @@ class UIDGenerator { // microtime() and gettimeofday() can drift from time() at least on Windows. // The drift is immediate for processes running while the system clock changes. // time() does not have this problem. See https://bugs.php.net/bug.php?id=42659. - if ( abs( time() - $time[0] ) >= 2 ) { + $drift = time() - $time[0]; + if ( abs( $drift ) >= 2 ) { // We don't want processes using too high or low timestamps to avoid duplicate // UIDs and clock sequence number churn. This process should just be restarted. flock( $handle, LOCK_UN ); // abort - throw new RuntimeException( "Process clock is outdated or drifted." ); + throw new RuntimeException( "Process clock is outdated or drifted ({$drift}s)." ); } // If microtime() is synced and a clock change was detected, then the clock went back if ( $clockChanged ) {