LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 09-20-2007, 11:54 AM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Rep: Reputation: 56
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
 
Old 09-20-2007, 02:30 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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.
 
Old 09-20-2007, 02:31 PM   #3
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
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.

Last edited by raskin; 09-20-2007 at 02:32 PM.
 
Old 09-20-2007, 09:44 PM   #4
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
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
 
Old 09-21-2007, 12:25 AM   #5
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
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
 
Old 09-21-2007, 12:43 AM   #6
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by raskin View Post
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
 
Old 09-21-2007, 03:34 AM   #7
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
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.
 
Old 09-21-2007, 09:02 AM   #8
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by raskin View Post
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

Last edited by satimis; 09-21-2007 at 09:04 AM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change the date format in the system tray clock bobbrandt SUSE / openSUSE 2 06-07-2007 02:19 PM
thunderbird puts time instead of date under 'date' header wabbalee Linux - Software 4 11-26-2006 05:58 AM
Adjust system date to hardware clock Winanjaya Linux - General 1 10-13-2006 06:52 AM
Start Date + Time Duration = End Date/Time calculator? ToBe Linux - General 3 09-26-2005 11:17 AM
setting date and time lynger Linux - Software 2 05-21-2004 01:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 04:12 AM.

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
Open Source Consulting | Domain Registration