A
A
afih2015-03-13 22:45:57
PHP
afih, 2015-03-13 22:45:57

When using time(), where does the hour difference come from?

out of 1000 script calls, time() returns a timestamp 1 hour more than the current time.
put timesonedb:
$ php -i | grep timezonedb
565:timezonedb
didn't help.
I don't override timezone in scripts.
I am using vagrant (puphpet build).

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
Evgeny Neverov, 2015-03-14
@deMone

Check which timezone the date_default_timezone_get() PHP function gives you and change it to the correct one using the date_default_timezone_set() function if it is incorrect.

B
Barnie Savington, 2015-03-14
@iwex

Try checking the time on the server

A
Andrey Burov, 2015-03-14
@BuriK666

Perhaps you have old timezone-data on your server and your clock has expired...

A
afih, 2015-05-25
@afih

for each access write to the log file time value (s) and the current time zone (date_default_timezone_get ()) and receive for every thousand 3-5k downloads:
1432570520 UTC
1432570521 UTC
1432570521 UTC
1432570522 UTC
1432570522 UTC
1432574601 UTC
1432574601 UTC
1432574602 UTC
1432574602 UTC
1432574603 UTC

1432570526 UTC
1432570527 UTC
1432570528 UTC
1432570529 UTC
1432570530 UTC
1432570531 UTC
1432570532 UTC
1432570533 UTC
1432570534 UTC
14325705
set to timezoneb php.zoneb Does not help. what else can you recommend?
time on the server Mon May 25 20:37:00 MSK 2015
I set the timezone explicitly at the beginning of the script date_default_timezone_set('UTC');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question