LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-18-2010, 02:28 AM   #1
Josh000
Member
 
Registered: Aug 2009
Distribution: Slackware 13 64bit
Posts: 534

Rep: Reputation: 35
Clocks won't remain set


I had to reinstall Windows recently, which reset my clock under Linux.

No problem, I set the clock, and then set the hardware clock to the system clock.

Rebooted under Windows, and both were fine.

After rebooting into Slack, it is again a few hours off.

How can I change this permanently?
 
Old 05-18-2010, 02:31 AM   #2
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,683

Rep: Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375
as root

netdate time-a.nist.gov
 
Old 05-18-2010, 02:35 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

You are running windows which means that your bios time should be localtime and not UTC. Change the linux time accordingly.

Hope this helps.
 
Old 05-18-2010, 03:16 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
The simplest way to fix it would be to run the Slackware installation script that asks "HARDWARE CLOCK SET TO UTC?". It's /usr/sbin/timeconfig and needs to be run by root.

Alternatively you can adjust Windows instead of Slackware () by registry setting [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation], “RealTimeIsUniversal”=dword:00000001 but this LQ post suggests it doesn't work perfectly -- so maybe not the best choice.

If contemplating NTP (highly recommended) then NTP Pool Project is helpful when choosing time servers.
 
Old 05-18-2010, 05:15 AM   #5
Josh000
Member
 
Registered: Aug 2009
Distribution: Slackware 13 64bit
Posts: 534

Original Poster
Rep: Reputation: 35
I already tried setting the date with date and then doing hwclock --systohc, I also tried timeconfig. Nothing is permanent.

The thing is, I don't get why this happened.

I was previously running Linux and Windows fine without any issue.

Why would this cause the hwclock to be changed? Which is what I assume happened...

Last edited by Josh000; 05-18-2010 at 05:16 AM.
 
Old 05-18-2010, 06:55 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by Josh000 View Post
I was previously running Linux and Windows fine without any issue.

Why would this cause the hwclock to be changed? Which is what I assume happened...
IDK why it was OK before and is not OK now.

To recap on the hardware architecture for anyone that's interested ...

The computer has a real-time clock (RTC). It is supplied with battery power and can thus keep time while the computer is switched off. In PCs, it used to be a separate chip but is now typically incorporated in the Southbridge chip. The RTC is optimised for low power consumption and occasional reads.

Then there is the "system clock". Hardware implementation has evolved considerably to match the needs of higher CPU speeds and multi-core CPUs. Initially a separate chip, it was incorporated in the CPU from the Pentium and K8 as the Time Stamp Counter (TSC) and now we have the High Precision Event Timer (HPET) supported by the Linux kernel from 2.6.

The system clock is optimised for frequent reads and high precision.

On boot, Linux loads the system clock from the RTC thus initialising with hopefully the correct time. On shutdown, Linux synchronises the RTC to the system clock which is hopefully accurate, being set by NTP.

That is when the OS changes the RTC. Linux systems default to running clocks on UTC and use the timezone value when displaying time. Windows defaults to running clocks on local time. Thus when Linux shuts down, if it has the correct time, it sets the RTC to correct UTC whereas when Windows shuts down, if it has the correct time, it sets the RTC to correct local time.

No problem if you don't dual boot or you live in a UTC time zone without daylight saving.
 
Old 05-18-2010, 07:05 AM   #7
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
If you have not done so, make sure that both Windows (and do it first) and Slackware (do this second) are set to the same time zone; i.e., use Control Panel, Date and Time, Time Zone and chose either GMT Greenwich Mean Time or your local time zone and click OK. Then open a command prompt from the Accessories menu and enter
Code:
net time /setsntp:pool.ntp.org
(assuming you've got Internet access in Windows) to set the clock -- this should set your BIOS properly.

Then, shut down Windows, boot Slackware and log in as root then
Code:
ps -ef | grep ntpd
If NTPD is running, stop it with
Code:
/etc/rc.d/rc.ntpd stop
Execute timeconfig and make sure that the time zone setting is whatever you set it to in Windows; i.e., either GMT or your local time zone. If it isn't the same, set it now.

Edit /etc/ntp.conf and make the server section (near the top of the file) look like this:
Code:
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10
#server  pool.ntp.org
server  0.us.pool.ntp.org
server  1.us.pool.ntp.org
server  2.us.pool.ntp.org
If you're not in the US, use the country code for where you are.

Set the clock with
Code:
ntpdate pool.ntp.org
which will slew the clock to the correct time in your time zone (and that should be the same as it was in Windows).

Finally, start NTPD
Code:
/etc/rc.d/rc.ntpd start
and wait a few minutes and execute
Code:
ntpq -p
and you should see something like this:
Code:
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 LOCAL(0)        .LOCL.          10 l   58   64  377    0.000    0.000   0.001
*clock-a.develoo 207.171.30.106   2 u 1000 1024  377   74.184   -2.173   0.507
+mirror          204.9.54.119     2 u  895 1024  377   18.738  -10.994   3.719
+barricade.rack9 128.138.188.172  2 u  829 1024  377   20.252   -2.834   0.353
which will indicate that your clock is synchronized.

Twice a year you'll have problems with Stupid Time (daylight savings) because Windows will roll the clock an hour like it or not (so, stop using Windows?). You'll boot Windows, the clock will roll one hour, and yadda-yadda. Reset it, in Windows, in a command prompt as above before you shut it down and reboot Slackware.

Hope this helps some.
 
  


Reply



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
how to synch my clocks? hank43 Linux - Newbie 3 11-18-2006 07:23 AM
Put 2 clocks madmax1143 Linux - Software 2 07-21-2006 08:36 AM
my clocks are weird boxerboy Fedora 9 08-07-2005 09:38 PM
Syncronize Clocks newuser455 Linux - Newbie 2 07-15-2005 08:23 PM
Synchronising servers' clocks Paulo Góes Linux - Hardware 1 09-05-2003 12:31 PM

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

All times are GMT -5. The time now is 12:19 PM.

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