Re: Something wierd with time() and curdate()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for trying to help me...

I just found out what the problem was... I use the number of seconds in a day (86400) as a constant Yesterday there wasn't 60*60*24 seconds in a day though... It was acctually 60*60*25 seconds... That's why the script flipped out at 11 pm... Also, in the spring time when we change the time again there will be 60*60*23 seconds... I think I'll live with this, since the script won't generate any serious error...


thanks again

_bobo
dev@xxxxxxxxxxxxx

----- Original Message ----- From: "Jason Wong" <php-db@xxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Monday, November 01, 2004 11:14 AM
Subject: Re: Something wierd with time() and curdate()



On Sunday 31 October 2004 22:45, Bobo Wieland wrote:
There is something wierd going on over here...

I have a date field, datum, in mysql that I cast to a timestamp and check
against time(). If the datum value is more than one day old the table finds
a new random row and sets the datum field to CURDATE(). Now, this has
worked for two years now, but today the script suddenly finds a new random
row each time the script is run...

Would this line have anything to with it? If not, post some concise code (see
below).


mysql_data_seek($result, rand(0,$rows));


I've notice this just after 11 pm today.
As I can see from some debugging time() allways returns a higher value than
the timestamp + 86400... Have I missed something in this script for the
last couple of years or is there a bug somewhere? Could it have something
to do with the fact that we turned the time back one hour last night?


This is the code btw:

Please *try* to isolate the problem and post CONCISE code which sufficiently
illustrates your problem. For example (for this particular problem) if you
suspect PHP is calculating the dates incorrectly then a few lines of code
showing the date calculations would be sufficient. If you suspect MySQL is
the culprit then a single query would be sufficient.


--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
"There are things that are so serious that you can only joke about them"
- Heisenberg
*/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux