note 34190 added to ref.datetime
| From: | bishop at rack1 dot php dot net | Date: | Thu, 17 Jul 2003 23:08:19 +0000 |
| Subject: | note 34190 added to ref.datetime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52303@lists.php.net to get a copy of this message | ||
Beware of your system clock; it's not guaranteed to be monotonic increasing.
For example, say I'm your lazy system administrator, and I notice our system clock is slow by 1
minute. What do I do?
Easy (wrong) answer: set the date ahead 1 minute
Hard (right) answer: increase the rate at which seconds tick to "catch up" with the actual
time.
Anyway, if your script's doing something time sensitive (like profiling code), and I (lazy
admin) set the clock ahead 1 minute, you'll find your run times are 1 minute longer than
they'd otherwise be. As a corollary, the clock might be set back, and you find your script ran
in less (or negative) time than it would've otherwise.
So, beware when adding/subtracting the times given by gettimeofday() etc. There is no guarantee
they represent wall clock time.
If you're absolutely in need of authoritative timestamping, contact a stratum 1 or 2 time
server (e.g., bonehed.lcs.mit.edu, ncnoc.ncren.net, etc)
----
Manual Page -- http://www.php.net/manual/en/ref.datetime.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34190
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34190&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34190&report=yes