Req #55292 [Opn->Csd]: localtime should default to current time if "NULL" is passed
| From: | heiglandreas@php.net | Date: | Thu, 12 Jan 2017 20:56:49 +0000 |
| Subject: | Req #55292 [Opn->Csd]: localtime should default to current time if "NULL" is passed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206583@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55292&edit=1
ID: 55292
Updated by: heiglandreas@php.net
Reported by: mail at oliwel dot de
Summary: localtime should default to current time if "NULL"
is passed
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Date/time related
Operating System: Linux
PHP Version: 5.3.6
-Assigned To:
+Assigned To: heiglandreas
Block user comment: N
Private report: N
New Comment:
Looks like localtime does exactly what you were looking for in supported versions of PHP: https://3v4l.org/rMVlY
Previous Comments:
------------------------------------------------------------------------
[2011-07-27 09:48:09] mail at oliwel dot de
Description:
------------
It would be nice to make localtime() to use the current time as a default if the passed time
argument is NULL.
Reason: It makes a lot of extra work if the localtime call is called with an optional timestamp
parameter passed from outside
Test script:
---------------
localtime(is_null($iTime) ? time() : $iTime)
should be shorter:
localtime($iTime)
where time is a timestamp or null for the current time. At the moment NULL is interpreted as 0 which
is not what (at least) I expect.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55292&edit=1