note 34190 deleted from ref.datetime by vincent
| From: | vincent@php.net | Date: | Thu, 11 Sep 2003 11:59:24 +0000 |
| Subject: | note 34190 deleted from ref.datetime by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56088@lists.php.net to get a copy of this message | ||
Note Submitter: bishop
----
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)