note 56312 deleted from function.time by sean

From: Date: Wed, 31 Aug 2005 00:00:40 +0000
Subject: note 56312 deleted from function.time by sean
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-94469@lists.php.net to get a copy of this message
Note Submitter: ---- > Too many people are doing this in here > and its BAD programming practice: > BAD: $timeinfuture = time() + 60 * 60; > GOOD: $timeinfuture = strtotime("+1 hour"); > Reasoning: Leap days / seconds etc... I don't think that's true. 1) Leap days are just fine, since if we add 3600 seconds, we get 1 hour into the future, regardless of whether that future is a leap day or not 2) Leap seconds do not *exist* with the value returned from the time() function. This is a point of great debate in the ISO committees, but no changes are possible now without breaking compatibility. What I mean is, at the transition of a leap second, the time() function is supposed to return values like this: 1320, 1321, 1322, 1322, 1323... (Here, the time() function will return the same value for both the LEAP SECOND and the second before it) So, once again, adding 3600 gets us the desired result (That is, if before it was Jan 3 at 3:45 AM, then we will get Jan 3 at 4:45 AM, regardless of leap seconds or leap year)

« previous php.notes (#94469) next »