diff options
| author | Christian Schneider | 2026-03-23 14:49:23 +0100 |
|---|---|---|
| committer | Christian Schneider | 2026-03-23 14:49:23 +0100 |
| commit | 7211d0baed1e77db85ab0c21062ddeeecac7caaf (patch) | |
| tree | 72d4568d4eb19270e17c7b8d8db2897a0ca92cd0 | |
| parent | 53cea921e33a9bfc7f98e873c5f791f74edfaa78 (diff) | |
| download | itools-master.tar.gz itools-master.tar.bz2 itools-master.zip | |
| -rw-r--r-- | it.class | 10 | ||||
| -rw-r--r-- | it_auto_prepend.php | 2 | ||||
| -rw-r--r-- | it_dbi.class | 8 |
3 files changed, 10 insertions, 10 deletions
@@ -115,7 +115,7 @@ static function log_line($name, $line) static function timerlog($label = '') { if ($GLOBALS['debug_timerlog']) - $GLOBALS['ULTRATIMERLOG'] .= sprintf(" %s:%d", $label, (gettimeofday(true) - $GLOBALS['ULTRATIME'])*1000); + $GLOBALS['ULTRATIMERLOG'] .= sprintf(" %s:%d", $label, (hrtime(true) - $GLOBALS['ULTRATIME']) / 1_000_000); } @@ -688,12 +688,12 @@ static function exec($cmd, ...$args) { $args = array_reduce($args, fn($carry, $v) => array_merge($carry, (array)$v), []); # varargs to single array $cmd = it::shell_command($cmd, $args); # NOPHPLINT - $before = gettimeofday(true); + $before = hrtime(true); if ((!($args['_callback'] instanceof Closure) || $args['_callback']($cmd)) && !EDC('noexec')) $result = (string)shell_exec("set +o posix\n" . $cmd); - @it::log('exec', round((gettimeofday(true) - $before)*1000) . "\t$cmd"); + @it::log('exec', round((hrtime(true) - $before) / 1_000_000) . "\t$cmd"); return $result; } @@ -708,13 +708,13 @@ static function system($cmd, ...$args) { $args = array_reduce($args, fn($carry, $v) => array_merge($carry, (array)$v), []); # varargs to single array $cmd = it::shell_command($cmd, $args); # NOPHPLINT - $before = gettimeofday(true); + $before = hrtime(true); $result = 0; if ((!($args['_callback'] instanceof Closure) || $args['_callback']($cmd)) && !EDC('noexec')) system("set +o posix\n" . $cmd, $result); - @it::log('exec', round((gettimeofday(true) - $before)*1000) . "\t$cmd"); + @it::log('exec', round((hrtime(true) - $before) / 1_000_000) . "\t$cmd"); return $result; } diff --git a/it_auto_prepend.php b/it_auto_prepend.php index b606e3f..3abcf9c 100644 --- a/it_auto_prepend.php +++ b/it_auto_prepend.php @@ -17,7 +17,7 @@ ** along with this program. If not, see <http://www.gnu.org/licenses/>. */ -$GLOBALS['ULTRATIME'] = microtime(true); +$GLOBALS['ULTRATIME'] = hrtime(true); unset($GLOBALS['IT_SYNTAXCONVERTER_DIR']); # Security measure for register_globals on #$debug_itclassloader = true; 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) { |