[php-src] master: perf: avoid floating-point formatting in microtime (#23604)
| From: | Marc via GitHub | Date: | Wed, 18 Nov 2026 17:43:26 +0000 |
| Subject: | [php-src] master: perf: avoid floating-point formatting in microtime (#23604) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143850@lists.php.net to get a copy of this message | ||
Author: Marc (henderkes)
Committer: GitHub (web-flow)
Pusher: arnaud-lb
Date: 2026-11-18T18:43:23+01:00
Commit: https://github.com/php/php-src/commit/7bf6fa8f5f0f94a317067214188cf3614e91f7fd
Raw diff: https://github.com/php/php-src/commit/7bf6fa8f5f0f94a317067214188cf3614e91f7fd.diff
perf: avoid floating-point formatting in microtime (#23604)
Changed paths:
M ext/standard/microtime.c
Diff:
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
index 46e770dec3ee..efe655a80601 100644
--- a/ext/standard/microtime.c
+++ b/ext/standard/microtime.c
@@ -73,7 +73,7 @@ static void _php_gettimeofday(INTERNAL_FUNCTION_PARAMETERS, int mode)
timelib_time_offset_dtor(offset);
} else {
- RETURN_NEW_STR(zend_strpprintf(0, "%.8F %ld", tp.tv_usec / MICRO_IN_SEC,
(long)tp.tv_sec));
+ RETURN_NEW_STR(zend_strpprintf(0, "0.%06ld00 %ld", (long)tp.tv_usec, (long)tp.tv_sec));
}
}