From 7536739c7ac91ed2e3f0fb61455fd295d0df1459 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 12 Jun 2016 09:16:54 +0200 Subject: [PATCH] Fix bug where microsecond format in logged date didn't work in some cases --- program/lib/Roundcube/rcube_utils.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php index c64dfa838..04447f788 100644 --- a/program/lib/Roundcube/rcube_utils.php +++ b/program/lib/Roundcube/rcube_utils.php @@ -1193,10 +1193,13 @@ class rcube_utils $format = 'd-M-Y H:i:s O'; } - if (strpos($format, 'u') !== false - && ($date = date_create_from_format('U.u.e', microtime(true) . '.' . date_default_timezone_get())) - ) { - return $date->format($format); + if (strpos($format, 'u') !== false) { + $dt = number_format(microtime(true), 6, '.', ''); + $dt .= '.' . date_default_timezone_get(); + + if ($date = date_create_from_format('U.u.e', $dt)) { + return $date->format($format); + } } return date($format);