By drupalshrek on
In the VChess module, everything was OK in development, but as soon as I put it 'live' in my chess website chesspos.com I saw that the 'Time left' for a game was all wrong. For example, if I start a game with a move limit of 1 day, on my local server it shows correctly a time left of "23 hours, 59 mins, 59 secs", but when I run it on the production server, it shows a time left of "14 hours, 59 mins, 59 secs"!
It's maybe more of a PHP question, but how do I get the server time? I am currently using the PHP time() function.
Thanks!
drupalshrek
Maintainer of the VChess module visible in use at chess website Chesspos.com
Comments
Just a guess, but ...
This looks like a timezone issue.
php time() should return seconds since the Unix epoch in GMT.
Depending on how you are storing time in your database, you might be dealing with adjusted numbers.
Notice how php date() and MySQL timestamps default to timezone-adjusted, but time() is always GMT-absolute.