Using the timestamp of PHP's time() function, I show the current time to the user with date().
Format: H:i => 13:57
But sometimes there seem to be leaps in time. My windows clock was showing 13:40 when I visited the page. But my website said 14:XX. I don't know the exact time any more.
Another example: A user accessed the page "Who is online?" at 00:16. A user was listed with the time for his last action being 00:39. The last action time is written to the database on every page load. So the time() function must have given back 00:39 at 00:16 and the wrong value must have been written to the database.
How could this happen?
Thank you very much for your help :)
Edit #1 I've reduced my code to the parts which are important for this problem:
I save the timestamp to a new variable with $tStamp = time() in serverData.php and this file is included in index.php where I show the time to the user with date('d.m.Y, H:i', $tStamp). The variable $tStamp isn't changed in any other line.
Edit #2 Users on my website noticed a wrong time on 2010-01-21 00:16 where the page showed 00:39 for a very short moment. I've had a look into the log files and around this time there's one complete hour missing in the logfiles:
127.0.0.1 - - [20/Jan/2010:23:34:53 +0100] ...
127.0.0.1 - - [20/Jan/2010:23:34:55 +0100] ...
127.0.0.1 - - [21/Jan/2010:00:38:41 +0100] ...
127.0.0.1 - - [21/Jan/2010:00:38:41 +0100] ...
My hoster announced maintenance work for 2010-01-20 00:00-06:00. Do you think that the maintenance was set back? Could it be the case that the maintenance work was done on the next day in this time period? Could such a work make the time wrong?
Edit #3 Finally, I have an answer from my hoster :) In the given period of time, the server crashed. And because of that the watch/clock stopped. It was that simple but I didn't think of a server crash. Thank all of you very much!