From cfdf0190f39bce38f820a637997cdf359a7b0d0a Mon Sep 17 00:00:00 2001 From: Jason Morriss Date: Mon, 14 Nov 2022 13:48:45 -0500 Subject: [PATCH] Updated Daemon::getLogPrefix to work regardless of locale. @npub --- src/Daemon.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Daemon.php b/src/Daemon.php index 212d904..f6859aa 100644 --- a/src/Daemon.php +++ b/src/Daemon.php @@ -870,10 +870,13 @@ public function output(string $msg) */ protected function getLogPrefix(): string { - $time = array_pad(explode('.', microtime(true)), 2, 0); - // timestamp + microseconds -// return sprintf("%s%04d: %d: ", date('Y-m-d H:i:s.', $time[0]), $time[1], $this->pid); - return sprintf("%s%04d: %-6d %6d: ", date('Y-m-d H:i:s.', $time[0]), $time[1], $this->parentPid, getmypid()); + $time = explode(' ', microtime(), 2); // array (msec, sec) + return sprintf("%s.%04d: %-6d %6d: ", + date('Y-m-d H:i:s', $time[1]), + str_pad(substr(round($time[0], 4), 2), 4, '0'), + $this->parentPid, + getmypid() + ); } /**