LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (http://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Setting system date and time affecting the clock and date on BIOS (http://www.linuxquestions.org/questions/ubuntu-63/setting-system-date-and-time-affecting-the-clock-and-date-on-bios-586087/)

satimis 09-20-2007 11:54 AM

Setting system date and time affecting the clock and date on BIOS
 
Hi folks,


Ubuntu 7.04 server amd64


Sometime strange happened here. Running "date -s ...." to set date and time of the system affecting the clock and date on BIOS.


The story is as follow;

Recently the date and time on the system was not correct. I changed a new battery and reset everything. Each day after booting the PC I have to run "date ..." to reset the time.


Just made following test

Booted the PC and entered BIOS page. It was found;

System Time 4 6 21
System Date Fri Sep 21 2007

reset them and exited BIOS setup. Rebooted PC and entered the BIOS page again. The date and time there was found correct. Reboot the PC checking it twice.

Then rebooted PC and login as user. Ran "sudo reboot" to reboot PC. Entered BIOS setup page and found the time and date being correct.

Rebooted PC again and login as uesr.

Ran;
$ sudo date -s "09/20/2007 xx:xx:00"
to adjust date and time

Then;
$ sudo reboot
to reboot the PC

Entered BIOS setup page. It was found that the time was reset as;
System Time 4 6 21
System Date Fri Sep 21 2007

I checked it at least 3~4 time. If I did not change the system date and time, the time and date on the BIOS did not have problem. The time was running.

I don't know why changing the system date and time will affect the clock and date on the BIOS bringing it back to the same wrong time.

Please advise where shall i check. TIA


B.R.
satimis

bigrigdriver 09-20-2007 02:30 PM

Setting system and hardware clocks is a two-step process. First, run 'date' to set the system clock, then run 'hwclock' to set the hardware clock.

raskin 09-20-2007 02:31 PM

Where do you live? I think that Ubuntu shows you your local time and writes UTC (more or less, "GMT+0 no DST" for your purposes) to system clock on every reboot. If you adjust local time to be local time, UTC is just "a bit" ahead and wraps to Friday.

EDIT:
Yes, hwclock is for writing time to hardware clock, but I think Ubuntu runs it automatically on shutdown.

satimis 09-20-2007 09:44 PM

Hi folks,


Tks for your advice.


Made following test:-

$ sudo date -s "09/21/2007 09:20:00"
$ sudo /sbin/hwclock --systohc
both w/o complaint.

Rebooted PC and entered BIOS page. Time was still not correct.


So tried again.

$ sudo date -s "09:33:00"
Code:

Fri Sep 21 09:33:00 PDT 2007
$ sudo /sbin/hwclock --systohc
Code:

sudo: timestamp too far in the future: Sep 21 10:29:54 2007
What does it mean?

$ date -u
Fri Sep 21 16:33:57 UTC 2007

$ date
Fri Sep 21 09:34:15 PDT 2007

my location is Hong Kong


How to adjust UTC? TIA


B.R.
satimis

raskin 09-21-2007 12:25 AM

You don't adjust UTC. You can tell your system you want local time in hardware clock. I wouldn't do that, though.. It's /etc/default/rcS

satimis 09-21-2007 12:43 AM

Quote:

Originally Posted by raskin (Post 2898730)
You don't adjust UTC. You can tell your system you want local time in hardware clock. I wouldn't do that, though.. It's /etc/default/rcS

Something very strange happpend here.

Ran
# rm /etc/localtime
# ln -s /usr/share/zoneinfo/Hongkong /etc/localtime

to adjust time zone

then ran "date" to reset time.

Rebooted PC and entered BIOS page. The System Time was incorrect. The System Date is correct.

Adjusted the System Time on BIOS. Booting PC login as satimis.

The time was incorrect (date was correct). Ran "date" to adjust time.

Rebooted PC and entered BIOS page. The time has been reset automatically showing "4:26:37", the date being correct. Left them there untouched.

Booting PC again login as satimis.

satimis@ubuntu:~$ date
Fri Sep 21 12:34:45 HKT 2007

The date and time is correct.

Is it the problem of hardware OR Ubunto 7.04?


B.R.
satimis

raskin 09-21-2007 03:34 AM

I repeat it once again, the time in the BIOS is correct UTC. Ubuntu correctly translates it to local time. Nothing is broken (as in "behaves not as documented or loses data"). Why would you want to have local time in BIOS anyway? If you really want it, edit /etc/default/rcS - there is an option UTC.

satimis 09-21-2007 09:02 AM

Quote:

Originally Posted by raskin (Post 2898854)
I repeat it once again, the time in the BIOS is correct UTC. Ubuntu correctly translates it to local time. Nothing is broken (as in "behaves not as documented or loses data"). Why would you want to have local time in BIOS anyway? If you really want it, edit /etc/default/rcS - there is an option UTC.

I don't really want setting local time in BIOS. As normal practice after changing the battery usually BIOS will be reset. The clock there will be adjusted to local time becase I have no idea of UTC. After booting up the PC date and time will be reset as well. However rebooting to the BIOS page again I was surprised the time there changed automatically. I mistakenly thought it would be a problem. Especially on reading following thread;
http://ubuntuforums.org/showthread.php?t=149565

It injected me an wrong idea that there was a problem on BIOS.


That is the whole story.


B.R.
satimis


All times are GMT -5. The time now is 02:05 AM.