# Solved: Dual Boot (XP and Ubuntu) clock issues



## shobuz99 (Oct 15, 2007)

After a successful install and setup of Ubuntu 8.04 and XP to be dual booted (thanks to Tomdkat  :up, I've run into some minor annoyances.
One is my digital clock in the tray, on Windows XP.
Whenever I boot my machine, and select Windows, the digital clock in the tray is 4 hours ahead, ie. my time is EDT 4:00pm and the clock reads EDT 8:00pm.
I adjust the time (move it back 4 hours) and it's fine.
Then I reboot to Ubuntu and that clock is correct, ie 4:00pm EDT
When I reboot back to Windows, it's ahead 4 hours again...
Ubuntu is always correct, no need to change it.
I've tried to change settings within the Time/Date feature of XP, and it doesn't matter
what I do. Anyone have any suggestions?
Thanks
Shobuz99


----------



## lotuseclat79 (Sep 12, 2003)

Hi shobuz99,

4 hours ahead is consistent with UTC time, i.e. over in England from your locale in EDT region (I am in the Boston, MA area).

So, your timezone should be set for Eastern Daylight Time. If you are not adjusting the timezone to EDT, and simply changing the time, you are probably only changing the time for the duration of your session until you boot up again.

Are you changing the TimeZone in WinXP?

-- Tom


----------



## shobuz99 (Oct 15, 2007)

lotuseclat79,
Thanks for answering so quickly.
Yep. It is set for (GMT-05:00) Eastern Time (US & Canada)
in the Time Zone tab of Date and Time Properties.
under the Date & Time tab (calendar and clock), 
the statement at the bottom is:
"Current Time Zone: Eastern Daylight Time"

I've checked the BIOS and it is correctly set.

Is there another place in XP System (control panel)
where the Time Zone is REALLY set? 
Shobuz99


----------



## lotuseclat79 (Sep 12, 2003)

Hi shobuz99,

Most definitely there is - i.e. probably in the registry. I suspect there is a startup either application or system that is not properly set and resets the time back to UTC time every new bootup WinXP session.

The first thing I would do is visit microsoft.com and Search for "WinXP +setting timezone +registry and read all of the links for an answer.

One thing you can do is search for a Sysprep.inf file which is the answer file that can be modified. It has timezone settings you should check to see if they correspond to your problem when your system was setup initially.

One thing I heartily recommend for all WinXP users is to visit the SysInternals web page at microsoft.com and download a number of the utilities - you can never have enough good tools when using a Windows OS!

Other than those suggestions, this sounds like a problem you should post in the WinXP forum (as it has nothing to do with Linux - i.e. Linux is not the cause of your problem).

-- Tom


----------



## shobuz99 (Oct 15, 2007)

lotuseclat79,
Thanks for the suggestions.
I DO think that Linux (Ubuntu) plays a role in this mystery.
The reason, is that this problem didn't exist before I installed the Linux drive and the setup the dual boot process.
Yesterday, I moved the Windows XP item of the boot/grub/menu.lst
file, to the top of the list; instead of the bottom, where I put it originally.
I did this because I wanted to boot XP by default and not Ubuntu.
Today I booted my machine, default to XP, and when it came up,
the clock was correct.
Up until today, Ubuntu was the default. 
When I chose to reboot to Windows XP, the XP clock was now 4 hours off.
I will try this today and see what happens.
So, I believe Linux is taking control of the BIOS clock setting or something, 
when it is booted and Windows doesn't change it when I reboot to Windows.

I'll definitely look into your suggestions and put up the same question
on the Ubuntu forums as well.
Thanks for you help on this..
Shobuz99


----------



## lotuseclat79 (Sep 12, 2003)

Hi shobuz99,

In the file, boot/grub/menu.lst, if you insert the following line:
Default=0
then the first OS will be the default.
Setting Default=1 will default to the second, and so on.

You can also set the number of seconds to timeout of your preference:
Timeout=15
sets it to 15 seconds if the default 30 is too long to wait in choosing which OS to boot.

Let us know how things work out.

Working from a Linux Live CD environment everyday has its consequences as it forces me to reset the system time with every boot. On the plus side - I use an atomic watch with the date command to make it as accurate as possible without running an ntp server. Also, I know the specific changes that must be made to handle timezones properly along with daylight saving time.

If you have any problems with the Linux time, let us know also and we can help.

-- Tom


----------



## shobuz99 (Oct 15, 2007)

lotuseclat79
Sorry for the long delay between posts.
I have made some discoveries, but not yet solved the problem.

First, I was incorrect about saying that the BIOS did not change.
It did change. But only after I restart the computer from Ubuntu
and select the BIOS prior to the /boot/grub/menu.lst.
It always changes after Ubuntu.
If I boot to Windows from the /boot/grub/menu.lst, from cold start,
the clock in the BIOS is correct and the time is correct when it gets
to Windows. 
The only time it changes is when I decide to restart from Windows,
got to the /boot/grub/menu.lst and select Ubuntu. 
Once I have the Ubuntu screen up, the Time/Date in Ubuntu is correct, too.
Yet, when I restart from Ubuntu, the BIOS shows the clock to be 4 hours ahead.
Conclusion: Ubuntu is changing the BIOS.
Question: Why?
Thanks
Rick (Shobuz99)


----------



## shobuz99 (Oct 15, 2007)

Just an update to say that my problem has been solved.
I finally found out how to change a file in Ubuntu that sets the clock
to local time instead of UTC or Universal Time; which is 4 hours exactly, ahead of Eastern time.
From Ubuntu forum:
_"To keep Linux from using UTC Right click on the clock > Preferences > uncheck the UTC box. 
Or if you don't have the clock edit /etc/default/rcS and change the line UTC=yes to UTC=no
If you need to change the timezone this can be done by running sudo tzselect"_

I also didn't know how to log in as root and change the UTC settings,
which is what is required to change it. I got access denied when I tried the command logged in as Rick...
Here's the command that I got from another person on the same forum
to change it in root. 
From Ubuntu forum:
_"gksu gedit /etc/default/rcS"_ (don't use quotes)

This solved my problem, once I set the UTC to 'no'.
Apologies to this forum for getting the answer from a different forum.
No disrespect intended.
Hopefully, this information can help someone else, who is new to Ubuntu and Linux.
Thanks again for everyone's help on this.
Rick (Shobuz99)


----------



## lotuseclat79 (Sep 12, 2003)

Hi Rick,

Here is how I setup my localtime (I use a Live CD, so Ubuntu 8.04 LTS is not installed):

To get into the root account (on Live CD - probably requires root account password for an installed OS): Use Applications>Accessories>Terminal to bring up a command line window (for ubuntu regular user), then type in the command:
[email protected]:~$ sudo -i
which kicks you into the root account.

Then I run the following code in a script:
# setup local timezone:
rm /etc/localtime
# setup for EDT and EST (+4 EDT; +5 EST)
ln -s /usr/share/zoneinfo/EST5EDT /etc/localtime
# setup for only EST (+5 EST)
#ln -s /usr/share/zoneinfo/EST /etc/localtime
rm /etc/timezone
echo "US/Eastern" > /etc/timezone
export TZ="/usr/share/zoneinfo/America/New_York"
#Note: as root, set system clock for UTC time after this script, i.e. date -u MMDDhhmm command using atomic watch or some other method which will then automatically due to the previous commands pick up the correct local time for EST5EDT. And, as Rick mentioned above, UTC (Greenwich Time aka GMT in London) is 4 hours ahead of EDT in USA, so, it is local time + 4 hours when you use the date command, as above.

-- Tom


----------



## shobuz99 (Oct 15, 2007)

lotuseclat79,
Thanks Tom.
I'm glad you showed the command to get to root: sudo -i
I did not know that.
Thanks again for all your help with this.
Hopefully this thread will help someone else.

Rick (Shobuz99)


----------

