LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   time modified when booting (http://www.linuxquestions.org/questions/linux-general-1/time-modified-when-booting-215687/)

xround 08-10-2004 04:23 AM

time modified when booting
 
Hello,

I installed the RH9 a few month ago, on my K6-2 500Mhz, and on my i5150 dell laptop. I have a multiboot on both, with windows installed on other partitions. And I have the same following problem : everytime I boot, the time is modified, it is a 2 hours.
For instance, let's say it 7 am. If I boot twice without correcting the time, it will be then nearly 11 am.
Does anyone know the origin of this problem, and how I can resolve it ?


Cheers, xround.

Riichard 08-10-2004 08:24 AM

You could try replacing the motherboard cmos battery.

xround 08-10-2004 10:27 AM

My laptop is rather new (it is a dell i5150 laptop I bought 8 months ago). Are sure it would solve the problem ?

Cheers, xround

foo_bar_foo 08-10-2004 11:20 PM

hi,

I know nothing about RH9 so i can't help with particulars

Posix traditionally uses UTC (Universal Time Coordinated) time ie. Greenwich Mean Time
Winblows on the other hand uses local time format.

Linux can use either so when you dual boot with windows you need to use local time
on your Linux system

check out a file /etc/sysconfig/clock
your ZONE (timezone) there should be correct and you should have
UTC=false

ok there is another file /etc/localtime that has to be correct
you have a program there on redhat (i hope) called "tzselect"
run that and follow along
when you are done write the last line on a text editor
it's you timezone i will call it variable $TIMEZONE
when i put $TIMEZONE you put the timezone you got fron tzselect
now (as root )
cp --remove-destination /usr/share/zoneinfo/$TIMEZONE /etc/localtime

OK now the last thing (this doesn't really sound like your problem though)
when your system boots up it reads the time from the BIOS hardware clock
if your time is still comming up all screwy after the changes above
then your hardware clock isn't keeping good time (alot of hardware clocks don't)
possible battery issue i don't use laptops so i don't know about that
so one sort of ok solution is to write the correct time out to the BIOS durring shutdown
that way at least it gets set periodically
(it is possible RH is doing this already i don't know)
read your bootscript /etc/rc.d/init.d/setclock or something to that effect and see
to write localtime to your hardware clock
and you can run this as root anytime
hwclock --systohc --localtime
look for that in the stop section of the script
if it's not there put it in in the proper plae or just before you shutdown run the command
you can put an alias in your root .bashrc like
alias set_hwclock='hwclock --systohc --localtime'
or something like that
here is another fun command for your root .bashrc if your system has ntpdate
alias set_sysclock='/usr/sbin/ntpdate 132.239.254.49'

xround 08-11-2004 09:24 AM

Hi foo_bar_foo,

I tried your advice and the problem seems to be fixed.
Quote:

Linux can use either so when you dual boot with windows you need to use local time on your Linux system
I have the multiboot windows + linux.

Quote:

check out a file /etc/sysconfig/clock
your ZONE (timezone) there should be correct and you should have
UTC=false
I had UTC=false. Also I had "TZ=Europe/Paris" set in file /etc/sysconfig/cloc.


Then I used tzselect, and had finally TIMEZONE=Europe/Paris.

Quote:

cp --remove-destination /usr/share/zoneinfo/$TIMEZONE /etc/localtime
The file /etc/localtime was a link to usr/share/zoneinfo/Europe/Paris, so I had to remove it before copying physically to /ets/localtime

Finally, I reboot under my RH9, and time was ok.
I also rebooted under windows, then rebooting back to RH9. And clock didn't change.

I don't really understand which things I did modify during this procedure, but it seems to be solved.
Well many thanks.

PS : I doubted my CMOS battery was failing, be cause booting under windows, the clock never changed. However thanks to you all.


All times are GMT -5. The time now is 09:03 PM.