LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-19-2011, 02:46 AM   #1
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
Either hw clock, or software clock misbehaving.


Hi, this is with Mandriva 2011 on a HP Compaq 6710b. Any way I set the date, it always seems to jump 2 hours in the future at each reboot!

What I tried so far (as root) comes down to this:
Code:
# cat >/etc/adjfile <<-end
0.0 0 0.0
0
LOCAL
end
# hwclock --set --noadjfile --localtime --date='2011-09-19 09:19'
# hwclock --hctosys --noadjfile --localtime
As this did not work, I initialized the adjfile again, and then also ran this:
Code:
# chattr +i /etc/adjfile
For now, I don’t know if this last step helped, but it shouldn’t be necessary anyway! Something is wrong here!

I forgot: my location is Europe/Paris, which currently (summer time) is GMT+2. However, it doesn’t show in the TZ environment variable, which is empty…

Does someone know how all this mess works (or should work)?

Yves.

Last edited by theYinYeti; 09-19-2011 at 02:48 AM. Reason: Important info missing
 
Old 09-19-2011, 05:03 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,899

Rep: Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746
Does the output of the date command show the correct timezone?
Usually if the time difference is your UTC offset then the hardware clock and system clock configuration is wrong. Typically the hardware clock is set for local (must be if you dual boot windows) and there should be a check box in the system time configuration setting that tells the OS that the hardware clock is set for local/UTC time.
 
Old 09-19-2011, 05:12 AM   #3
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 61
Hi michaelk,

Yes the timezone is correct: it shows “CEST”, which, according to the map in the following link, is the right timezone in summertime.
http://fr.wikipedia.org/wiki/Heure_d...urope_centrale
Also, this PC is indeed in dual-boot (although it’s been awhile since Windows was booted), hence the hardware clock is/should be LOCAL.
Here are the current values:
Code:
# date;hwclock -r
lun. sept. 19 12:11:18 CEST 2011
lun. 19 sept. 2011 12:11:19 CEST  -0.843020 secondes
…until next reboot…

Yves.
 
Old 09-19-2011, 06:44 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,899

Rep: Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746
Check the time/date settings to verify that the OS has set the hardware clock to local.
 
Old 09-19-2011, 07:15 AM   #5
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 61
The /etc/sysconfig/clock file contains:
Code:
UTC=false
ARC=false
ZONE=Europe/Paris
On the GUI part, when using Mandriva Control Center -> System -> Manage date and time, I can enter the timezone (Europe/Paris), and then it asks if I want to store the time in GMT format or not; here I answer No.

Yves.
 
Old 09-19-2011, 07:21 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,899

Rep: Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746
Should work...
Are you running NTP?
 
Old 09-19-2011, 07:35 AM   #7
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 61
No, I unfortunately cannot. I’m behind a very restrictive firewall on this PC…
Thank you michaelk. Maybe I’ll learn to live with this…

In fact, I’ve just had an idea: we have a Novell network, which can serve time in a format usable by an NCP tool; I may try and set the time on boot using that.

Last edited by theYinYeti; 09-19-2011 at 07:37 AM.
 
Old 09-19-2011, 08:26 AM   #8
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
So, this does not happen in Window$ ?
 
Old 09-19-2011, 09:13 AM   #9
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 61
Hi H_TeXMeX_H!
In Windows, there never was anything special with this laptop, apart from unbearable slowness
 
Old 09-19-2011, 09:18 AM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,899

Rep: Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746
So time does not jump...
 
Old 09-20-2011, 07:08 AM   #11
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 61
Some update. The PC was rebooted this morning. Even though /etc/adjtime was locked using chattr, the time has jumped 2 hours! (However, the adjtime file is still unchanged).
Now, I have set the hw and sys clock correctly again, and then I have disabled hwclock completely by renaming the command. I’ll see what the result is tomorrow morning…
 
Old 09-20-2011, 08:04 AM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,899

Rep: Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746
adjtime is supposed to only adjust time by small changes to the hardware clock. Its purpose is to compensate for drift.
http://linux.die.net/man/8/hwclock

Next time you reboot go into the BIOS settings and post the hardware clock time and verify it is local time.
 
Old 09-20-2011, 08:07 AM   #13
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 61
OK michaelk, I’ll do that tomorrow morning. Thank you for your help :-)
 
Old 09-21-2011, 03:13 AM   #14
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 61
Now, that’s a first for me! This BIOS doesn’t show nor allow changing the date and time!

Following my experience from yesterday, the date after boot is still wrong! This means that, without any way to properly read the hw clock (because the hwclock command is disabled), the system still decided by itself to propel time 2 hours ahead!

I thought… maybe this time the wrong time was precisely because hwclock was disabled. So I wrote a “hwclock” script which calls the real renamed one; it allows any kind of reading, but not writing:
Code:
#!/bin/bash

opts=( )
while [ $# -gt 0 ]; do
        case "$1" in
        --set|-w|--systohc|--adjust|--setepoch)
                :
                ;;
        *)
                opts[${#opts[*]}]="$1"
                ;;
        esac
        shift
done
exec "$0.ORIG" "${opts[@]}"
No change… BUT the hardware clock is still at the right time, hence a simple “hwclock --hctosys” makes things right :-)
I added the latter command to /etc/rc.d/rc.local, and I think it will be fine.

Still, it stinks…
Now, I’m thinking, that maybe that single line in /etc/rc.d/rc.local was all that was needed from the start, and maybe I could unlock both /etc/adjtime, and /sbin/hwclock… Any opinion on that?

Yves.
 
  


Reply

Tags
adjfile, compaq, date, hwclock, mandriva


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
Time Clock - Punch Clock Software dna9 Linux - Software 10 01-08-2014 12:38 PM
starting kttsd failed - and how to you set clock to 12 hour clock? Ook Slackware 3 08-13-2010 05:04 PM
BYE Clock skew detected. Check the clock on the file server Guardian-Mage Linux - Server 7 04-21-2009 09:48 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration