LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   timezones (https://www.linuxquestions.org/questions/linux-server-73/timezones-748105/)

bigtl 08-17-2009 07:46 AM

timezones
 
Hello,

I have just got the job of looking after a few debian servers as our sysadmin has jumped ship.

I have 2 machines, both are mysql database server, one is the master and the other is used as a slave.

I noticed that the time on both machines is different, running date on both machines gives:

Mon Aug 17 12:41:33 UTC 2009
Mon Aug 17 13:41:59 BST 2009

(I am in the UK and the bst one is currently the correct time). What timezone should I be using, my databases store timestamps for customers orders and it is vital that it is correct, I have been told that if I use bst then once british summer time finishes that my timestamps will be out by an hour, which I cant have.

Surely it cant be too difficult for my servers to always have the correct time.

Both machines have ntp on but i'm not sure what part that plays (i'm a developer not a sysadmin)

Any suggestions appreciated.

Nevahre 08-17-2009 07:53 AM

use google with: debian set timezone

You get a lot of hits for setting timezone on debian, also some tell how it all works.

repo 08-17-2009 07:56 AM

Use tzselect to set the timezone.

catkin 08-17-2009 08:30 AM

Both should be on UTC because:
  • Master and slave need to be identical.
  • It avoids jumps when switching to and from daylight saving (as already mentioned.)
  • It is the most commonly accepted "universal" time, hence the U in UTC
NTP only sets the time -- usually to UTC, the same as internally server clocks are most commonly set to -- it has nothing to do with the timezone. Common procedure (except in the Windows world) is to set clocks to UTC and then set the timezone to display local times as convenient.

aviso 08-17-2009 11:46 AM

Quote:

NTP only sets the time -- usually to UTC, the same as internally server clocks are most commonly set to -- it has nothing to do with the timezone. Common procedure (except in the Windows world) is to set clocks to UTC and then set the timezone to display local times as convenient.
Works exactly the same in the Windows world.

bigtl 08-17-2009 02:24 PM

Thanks everybody for your suggestions, all seems well now.

catkin 08-17-2009 04:22 PM

Quote:

Originally Posted by aviso (Post 3646766)
Works exactly the same in the Windows world.

I thought Windows, by default, set the BIOS clock to local time and this is, for example, an issue when dual booting ... ???

aviso 08-17-2009 05:23 PM

Quote:

I thought Windows, by default, set the BIOS clock to local time and this is, for example, an issue when dual booting ... ???
Now that's something different, we were talking about NTP and how local time is displayed. Windows, like Linux distributes time via NTP (or SNTP) in UTC. Windows, like Linux, keeps time internally with UTC and adds the time zone only when displaying local time. The difference is how time is stored, by default, to the hardware clock. Windows, by default stores time on the hardware clock in local time. There is an option to do this:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001

Unfortunately that option isn't really supported and some parts of Windows ignore it :-)

As for Linux, while the default is often to store the time on the hardware clock in UTC, it's very easy to change, so for a dual boot machine, that's a pretty easy fix. On Red Hat or Fedora systems you change the UTC line in /etc/sysconfig/clock. I'm not sure about other distros, but I'm sure it's similar. In Ubuntu it's in /etc/default/rcS.

So yeah, they work the same, just the default setting for the hardware clock is different. And if you're dual booting, just change Linux, in understands change, it doesn't resist :-)


All times are GMT -5. The time now is 10:59 PM.