note 129320 added to function.microtime

From: Date: Fri, 08 Mar 2024 11:34:28 +0000
Subject: note 129320 added to function.microtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-221238@lists.php.net to get a copy of this message
microtime() does not return microseconds in neither of the return modes Normally returns "0.39081500 1709893727", first value trying to express the microsecond precision, but failing, because microseconds are a millionth part of a second, which means 6 decimals, not 8 Second mode returns numbers like these "1709894168.1621", "1709894209.819", with 3 or 4 decimals, depending on mood, but never with 6, as the function would suggest To be able to actually return microseconds or seconds with microsecond precision, I am using a wrapper function microtime_real($inSeconds = false) { if ($inSeconds === true) { return number_format(microtime(true), 6, '.', ''); } return (string)intval(microtime(true)* 1000000); } ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.131 (proxied: 86.123.35.102) ---- Manual Page -- https://php.net/manual/en/function.microtime.php Edit -- https://main.php.net/note/edit/129320 Del: integrated -- https://main.php.net/note/delete/129320/integrated Del: useless -- https://main.php.net/note/delete/129320/useless Del: bad code -- https://main.php.net/note/delete/129320/bad+code Del: spam -- https://main.php.net/note/delete/129320/spam Del: non-english -- https://main.php.net/note/delete/129320/non-english Del: in docs -- https://main.php.net/note/delete/129320/in+docs Del: other reasons-- https://main.php.net/note/delete/129320 Reject -- https://main.php.net/note/reject/129320 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221238) next »