LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-12-2006, 07:57 AM   #1
idc12
LQ Newbie
 
Registered: Sep 2006
Posts: 4

Rep: Reputation: 0
5 hour time difference between different configurations


Can anyone tell me what is going on?
Is there an alternative way to set the timezone?

I originally thought this issue was related to a Windows/Linux difference but now I have more information.

I have an embedded system (not a desktop) where I have a Linux development system (kernel 2.6.7 and Slackware) on a hard disk and a Linux target system (kernel 2.6.7 and BusyBox) on a Flashdisk.

Both the hard disk and the Flashdisk systems share the same processor. I can use LILO to choose which system I boot.

The system originally came to me from the West Coast and I didn't pay any particular attention to how the date/time was being displayed. Recently I decided to change the timezone setting to EDT since that is more appropriate to where I am located.

On the development system (Slackware) I found that the /etc/localtime was a symlink to /usr/share/zoneinfo/US/Pacific so I simply changed it to a symlink to /usr/share/zoneinfo/US/Eastern.
The embedded system (BusyBox) did not have a /etc/localtime file so I simply copied the /usr/share/zoneinfo/US/Eastern file from the development system and renamed it as /etc/localtime.

Both changes show the date/time as EDT when I used the 'date' command. However when I set the correct time on one system, shutdown, and restart the other system I find that the other system is showing a different time. Specifcally the development system is 5 hours ahead of the embedded system.

Is there another place that one, or other, of the systems is getting/saving the current time? They both share the same system clock so I am thinking it must be the way in which they are interpreting that information.

Last edited by idc12; 10-12-2006 at 08:36 AM. Reason: More information about the problem
 
Old 10-12-2006, 09:26 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
as it's a 5 hour offset it sounds like one os is using the system clock as local time, the other is using it as UTC. As UTC is, of course, the right time, and anyone not living in UTC timezones are inherently defective () you shoul dchange both operating ssytems to treat the bios clock as UTC and not your local time zone. or ignore your shortcomings and set both to use it as local time. then you'll get no variance.
 
Old 10-12-2006, 03:42 PM   #3
idc12
LQ Newbie
 
Registered: Sep 2006
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks, you are absolutely correct.

After doing some more searching around I discovered that my development system is using 'localtime' and the target system (BusyBox) is using UTC.

Since I have to interface with Windows I am planning to change the target system over to 'localtime'. I see that to keep everything tidy I need to set the system time to the hardware clock when the system boots, and then save the system time to the hardware clock when I reboot or shutdown. I can find a way of doing the first, but I am having trouble finding any sort of reboot or shutdown script for BusyBox.

Anyone know of a way to change the way BusyBox shuts down?
 
Old 10-12-2006, 04:02 PM   #4
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,891

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
If I understand how the system and hardware clocks are synchronized, it seems to me that a two-command step is called for to set the system time, then synchronize the hardware clock. Upon boot, the kernel (no matter which OS) will set system time to match the hardware clock.

first command:

date (plus date and time info). see the date man pages for the correct format. this will set the system time.

second command:

hwclock --hctosys. this will synchronize the hardware clock with the system time you just set in command one above.

Now, with the hardware clock set, no matter which OS you choose to boot, it should synchronize with the hardware clock.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Subversion timestamp in file darkarcon2015 Linux - Software 1 05-17-2006 07:45 PM
How to get the timestamp of a file? operand Linux - Newbie 7 01-20-2006 04:14 AM
Insert date and timestamp Into File name petenyce Linux - Newbie 9 10-13-2005 12:16 PM
Timestamp of file/directories Ephracis Linux - Software 1 12-16-2004 09:21 AM
add timestamp to name of file how? supafly Linux - General 3 11-14-2001 11:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:21 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration