DreamHost Web Hosting
Discussion Forum


Forums
   >> Programming
*Threaded Mode

Subject Date() goes backwards??  
Posted byshelves (DH Regular)
Posted on11/14/06 05:36 AM



I made a test page that just outputs about 100 date('Y-m-d H:i:s');

Occationally (say, 1 out of 30 tries) the time goes backwards by one or two seconds. Like:

2006-11-14 07:29:16
2006-11-14 07:29:16
2006-11-14 07:29:16
2006-11-14 07:29:14
2006-11-14 07:29:14
2006-11-14 07:29:14

Or even reloading the page, the 2nd page will show an earlier time than the first page by one or two seconds.

It's no big deal. It's just interesting. I wonder, how can this happen? Something to do with threading? I don't get it.

Terry




Subject Re: Date() goes backwards?? new [re: shelves]  
Posted byshelves (DH Regular)
Posted on11/14/06 02:19 PM



Time() goes backwards too. In my test script I output time() with every Date(). I get things like this:

2006-11-14 14:13:44 (1163542424)
2006-11-14 14:13:44 (1163542424)
2006-11-14 14:13:44 (1163542424)
2006-11-14 14:13:44 (1163542424)
2006-11-14 14:13:44 (1163542424)
2006-11-14 14:13:44 (1163542424)
2006-11-14 14:13:44 (1163542424)
2006-11-14 14:13:44 (1163542422)
2006-11-14 14:13:42 (1163542422)
2006-11-14 14:13:42 (1163542422)
2006-11-14 14:13:42 (1163542422)
2006-11-14 14:13:42 (1163542422)
2006-11-14 14:13:42 (1163542422)
2006-11-14 14:13:42 (1163542424)
2006-11-14 14:13:44 (1163542424)
2006-11-14 14:13:44 (1163542424)
2006-11-14 14:13:44 (1163542424)
2006-11-14 14:13:44 (1163542424)


I assume Date is just generated from time().






Subject Re: Date() goes backwards?? new [re: shelves]  
Posted byshelves (DH Regular)
Posted on11/14/06 02:28 PM



Same problem with microtime(true):

2006-11-14 14:22:35 (1163542955) (1163542955.5044)
2006-11-14 14:22:35 (1163542955) (1163542955.5045)
2006-11-14 14:22:35 (1163542955) (1163542955.5046)
2006-11-14 14:22:35 (1163542953) (1163542953.9029)
2006-11-14 14:22:33 (1163542953) (1163542953.903)
2006-11-14 14:22:33 (1163542953) (1163542953.9031)
2006-11-14 14:22:33 (1163542953) (1163542953.9032)


This is during a single run on a single page. I just copy and pasted.





Subject Re: Date() goes backwards?? new [re: shelves]  
Posted bysilkrooster (DH Smarty Pants)
Posted on11/14/06 04:59 PM



There was a thread about something like this. I don't recall the details, but I thought it had to do with the time zone you are in compared to the server. But then again I could be dreaming. lol. Hope you figure it out.
Silk

My website


Subject Re: Date() goes backwards?? new [re: shelves]  
Posted byrlparker (DH Pooh-Bah)
Posted on11/19/06 01:21 PM



There is a previous thread on a similar "borkedness". In this thread, the similar problem was determined to be a kernel parameter issue, that DH support was able to fix.

--rlparker


Subject Re: Date() goes backwards?? new [re: rlparker]  
Posted byshelves (DH Regular)
Posted on11/19/06 01:45 PM




Thanks for the reference. I hadn't seen that.

I contacted support too, and they said the same thing: that it was a kernel param, and that it should be fixed - but, it's not. I replied back showing that the problem is exactly the same. So, the saga continues.

Terry




Subject Re: Date() goes backwards?? new [re: shelves]  
Posted byshelves (DH Regular)
Posted on11/22/06 04:07 AM



In reply to the 2nd support email about this and the cron problem, they had this to say, and it appears to be running great now:

"Most likely the same issue, but I have restarted cron, just in case. The
time problem is due the server running the wrong kernel, and that is
scheduled to be updated tonight."

Terry




*Threaded Mode
Jump to