Closed jiru closed 9 years ago
I think right now we generate the "ago" on server side, I think we can tackle two problems here at once by
1 - setting the server in UTC time, same for the date we save 2 - in the html pages, on server side ALWAYS generate the full time format in UTC time, and then use a javascript library to transform it into "ago" or local user time
this way it will both solve the DST problem , and it will permit to have less html changes, which will improve the "cache-ability" of the generated html
Question 1: is there anything that we have to take care of, to prevent horrible things from happening, before changing the time?
Question 2: is it enough to do the following.
/etc/timezone
ntpdate fr.pool.ntp.org
also change the php.ini i think
Question 1: is there anything that we have to take care of, to prevent horrible things from happening, before changing the time?
On the VM, changing the clock from UTC+1/2 to UTC+0 means going back to the past and repeating a timespan already spent. I don’t know if it’s dangerous on a server but I have a bad felling about it. What about rotating logs, active sessions…? Maybe a rebooting or shutting down the services is safer.
There is another problem I think it’s worth looking at. The clock of the host (as opposed to the VM) is misconfigured. It is set to 2 hours in the future. And so the VM is. We don’t strictly need to fix the clock of the host, but I suggest we do it while we’re tampering with the clock, so that we won’t have to do it after it eventually breaks things.
Question 2: is it enough to do the following.
- Change the timezone to UTC in /etc/timezone
- Then ntpdate fr.pool.ntp.org
Ntpdate will fix the clock on the VM regardless of the host. So fix the host first if you’d like to. I think the safer should be to shutdown the VM, run ntpdate on the host, start the VM, stop the services, fix the clock, start the services.
Finally, you also need to adjust the main index refresh time in sphinxsearch’s crontab (sudo -u sphinxsearch crontab -e
). It’s currently shifted to +3 hours to match the correct time.
note that going back to the past , at least for PHP is what is already happening as it's the very reason of the bug. It happened twice a year , every year and no one is dead.
I've written a more detailed procedure below (not sure about the exact commands for starting/shutting down the services).
Is there something missing or incorrect?
$ service nginx stop
$ service mysql stop
$ shutdown now
dpkg-reconfigure tzdata
("None of the above" > "UTC")$ ntpdate fr.pool.ntp.org
$ screen -ls
(to list the screens)
$ screen -dR <something>
to start a screen.
Then ./launch-qemu.sh
in the screen.$ service nginx stop
$ service mysql stop
dpkg-reconfigure tzdata
$ ntpdate fr.pool.ntp.org
/etc/php5/cli/php.ini
;date.timezone =
--> date.timezone = UTC
$ service mysql start
$ service nginx start
$ sudo -u sphinxsearch crontab -e
20 9 * * 6
--> 20 6 * * 6
the right ini file to edit is /etc/php5/fpm/php.ini I think it's working now, will take an hour for the negative minutes count to normalize
This has been observed on the 26 of October, 2014. Comments are also affected. Switching from DST makes you “jump in the past” so some dates appears to be in the future: -59 min(s) ago, -35 min(s) ago…
This happens because we store dates without the timezone they are relative to. Switching back/from DST means changing the time zone. This is how the time flows when DST ends: