Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.