From 7211d0baed1e77db85ab0c21062ddeeecac7caaf Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Mon, 23 Mar 2026 14:49:23 +0100 Subject: Switch ULTRATIME and some other runtime measurements to hrtime() --- it_dbi.class | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'it_dbi.class') diff --git a/it_dbi.class b/it_dbi.class index a3d2c31..24c271e 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -559,7 +559,7 @@ function clear() function query($query, $p = array()) { $p += $this->_p; - $start = gettimeofday(true); + $start = hrtime(true); if (($writing = !it::match('^(EXPLAIN|SELECT|SHOW)', $query, array('utf8' => false)))) { @@ -594,11 +594,11 @@ function query($query, $p = array()) if ($writing && $this->_p['throttle_writes']) { - it::log('debug', 'dbi-throttle', round(1000000 * (gettimeofday(true) - $start) * $this->_p['throttle_writes'])); - usleep(round(1000000 * (gettimeofday(true) - $start) * $this->_p['throttle_writes'])); + it::log('debug', 'dbi-throttle', round((hrtime(true) - $start) / 1000 * $this->_p['throttle_writes'])); + usleep(round((hrtime(true) - $start) / 1000 * $this->_p['throttle_writes'])); } - $msec = round(1000 * (gettimeofday(true) - $start)); + $msec = round((hrtime(true) - $start) / 1_000_000); $slow = $msec >= 2000; if ($GLOBALS['debug_sqllog'] || $GLOBALS['debug_sqltrace'] || $slow) { -- cgit v1.2.3