No-no, here it is not about productivity, but about the simple ordinary hours =)

Once he saw in PHP something like
$ date = mysql_result (mysql_query ( “SELECT CURRENT_TIMESTAMP”), 0, 0);

It seems to shitcode case …

Laughed and forgot. Then swapped windows surfing with ubuntu and here is something interesting happened yesterday =) MySQL and PHP in XAMPP (LAMPP) returned to a different current time!

print (date ( ‘Y-m-d H: i: s’));
/ / 2009-06-20 8:00:00

print ( “\ n”, mysql_result (mysql_query ( “SELECT CURRENT_TIMESTAMP”), 0, 0));
/ / 2009-06-20 15:00:00

because when windows surfing this problem does not occur, I looked up the net and learned that Linux and Windows differently interpret the system time. Windows makes the system time according to local (and doing it consistently every time you boot and synchronization), a Linux system finds UTC and local time is counted from the time zone assigned.

Solution 1. Match the system time for a local Linux

1. Set time to current.

user @ server: ~ $ sudo date-s 12:00

2. Make the local system time:

user @ server: ~ $ sudo / sbin / hwclock – systohc – localtime

3. Synchronize local and system time:

user @ server: ~ $ sudo / sbin / hwclock – hctosys – localtime

4. Reboot the computer if necessary. Well in my case, it was necessary to simply restart XAMPP / LAMPP

user @ server: ~ $ sudo / opt / lampp / lampp restart

Solution 2. Fit the time zone for MySQL

Presumably (as I am satisfied with the first solution) here:
dev.mysql.com/doc/refman/5.1/en/time-zone-support.html

Solution 3. Move to London

But since there is daylight saving time, this solution works only 6 months of the year. But as for the Algerian sys admins they have never faced up such a problem =)

Post a Comment