LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 08-17-2009, 08:46 AM   #1
bigtl
Member
 
Registered: Aug 2001
Location: Worksop England
Distribution: debian, fedora core
Posts: 35

Rep: Reputation: 15
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.
 
Old 08-17-2009, 08:53 AM   #2
Nevahre
LQ Newbie
 
Registered: Aug 2009
Posts: 21

Rep: Reputation: 16
use google with: debian set timezone

You get a lot of hits for setting timezone on debian, also some tell how it all works.
 
Old 08-17-2009, 08:56 AM   #3
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Linux Mint
Posts: 8,516

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
Use tzselect to set the timezone.
 
Old 08-17-2009, 09:30 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,557
Blog Entries: 28

Rep: Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178
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.
 
Old 08-17-2009, 12:46 PM   #5
aviso
LQ Newbie
 
Registered: Aug 2009
Posts: 6

Rep: Reputation: 1
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.
 
Old 08-17-2009, 03:24 PM   #6
bigtl
Member
 
Registered: Aug 2001
Location: Worksop England
Distribution: debian, fedora core
Posts: 35

Original Poster
Rep: Reputation: 15
Thanks everybody for your suggestions, all seems well now.
 
Old 08-17-2009, 05:22 PM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,557
Blog Entries: 28

Rep: Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178
Quote:
Originally Posted by aviso View Post
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 ... ???
 
Old 08-17-2009, 06:23 PM   #8
aviso
LQ Newbie
 
Registered: Aug 2009
Posts: 6

Rep: Reputation: 1
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 :-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timezones in C estratos Programming 2 03-15-2007 08:00 AM
Java - Calendar and TimeZones traene Programming 2 02-15-2007 03:19 AM
UTC Timezones TURN THEM OFF?!?!! Jimbo99 Linux - Software 3 08-09-2005 06:49 PM
timezones vexer LQ Suggestions & Feedback 2 05-02-2003 11:09 AM
TimeZones SkYzOpReNiCk Linux - Networking 0 04-25-2001 08:35 AM


All times are GMT -5. The time now is 09:33 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration