LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-23-2016, 07:01 PM   #1
happydog500
Member
 
Registered: Dec 2006
Location: Washington St.
Distribution: Linux Mint 21, Windows 11
Posts: 308

Rep: Reputation: 5
Linux Screws up Windows Time/Date Settings.


May seem like this is a Windows question, but since I only have this problem as soon as I installed Linux Mint 17, and the Windows forums probably don't deal with Linux, I thought I'd post it here, since the average Linux user generally know more then Windows.

When I boot to Linux, I use it for a while then if I need to use Windows, when I boot back into Windows 10, my date and time are all way off.

I go in and set it. It will work good. Boot into Linux, boot back into Windows, Windows date and time are way off.

Ever herd of that? What could be causing it? All the years of Windows, I never had this problem until I installed Linux.

Thank you,

Chris.
 
Old 04-23-2016, 07:15 PM   #2
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
I have the same problem with my Linux systems on my Desktop but I'm not running Windows.

I have Slackware on a 500 GB HDD by itself.
When I boot into Linux Mint Mate on the other 1 TB HDD with Korora on it all is well until I boot back into Slackware and I have to consistently fix the time.

At first I thought it was a BIOS clock issue. I checked on the BIOS clock and the time is right so I don't get what is generating this issue.
I haven't found a fix for this yet but maybe other members here have?

I suspect there is some kind of conflict between the hardware clock and the sytem or BIOS clock.

-::-If I find a fix I'll post it for you.-::-
 
Old 04-23-2016, 07:31 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,219

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
Your distro should allow you to set whether it keeps time in UTC or local time. In Slackware this is set with /sbin/timeconfig.

Windows keeps time in local time.
 
Old 04-23-2016, 07:39 PM   #4
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by dugan View Post
Your distro should allow you to set whether it keeps time in UTC or local time. In Slackware this is set with /sbin/timeconfig.

Windows keeps time in local time.
Thanks dugan but I have already tried timeconfig several times. No dice, it doesn't stick.
I have it set to UTC and it still gives me issues.

The only thing that helps are the commands I have to run in my blog about fixing the clock in Slackware.
 
Old 04-23-2016, 07:49 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
The problem is that the two (or more) OSs are configured differently. This is commonly a problem when dual booting GNU/Linux with another OS, but can also occur when booting different instances of GNU/Linux, as Ztcoracat has found.

Here is what happens...

There is a hardware clock, or BIOS clock, which keeps time when the system is powered off.

When the OS is booted it gets its starting time and date from the hardware clock, but it keeps time separately using kernel timers (i.e. a software clock), also called the system clock.

While running, most GNU/Linux distros will sync the system clock with a network clock using ntpd and the system configuration, so it is very accurate.

When the system shuts down, it updates the hardware clock from the now updated system software clock.

Where problems occur is when one OS is configured for a different time zone, or when it thinks the hardware clock is local time when it is really UTC. If the other OS sets the hardware clock to local time (adjusted for time zone) but the current OS thinks it is UTC, then when it starts it loads the time and adjusts for local time zone, and syncs with ntpd. Then when it shuts down it writes the adjusted time back to the hardware clock as UTC... so when the other OS boots it loads UTC but thinks it is local time!

The fix is simply to tell all OSs that the hardware clock is either UTC or local time AND that they are in the same local time zone. I always set my hardware clock to UTC.

Window$ was very ignorant of time and date last time I used it (16 years ago), but I expect it now uses NTP too, or not...

Anyway, on Slackware run timeconfig as root to set the hardware clock and local time zones. On other distros use whatever facilities they provide. The important thing is that ALL OSs that boot the same hardware agree on the time zone of the hardware clock - UTC or local.

*** UPDATE: As dugan notes, Window$ always assumed local time when I last used it, so GNU/Linux was forced to set hardware clock to local time too. If that is indeed still the same then you will have to let time-challenged Window$ have its way and set your Linuces to local TZ as well.

Last edited by astrogeek; 04-23-2016 at 08:11 PM.
 
1 members found this post helpful.
Old 04-23-2016, 07:55 PM   #6
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Thanks astrogeek-

I'll try timeconfig as root again and post if it works this time.
 
Old 04-23-2016, 08:00 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,679

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
Define way off.

If the time is off by your UTC/local time offset then it is a BIOS windows / linux setting. The BIOS clock and the setting in /etc/adjtime must match (UTC vs localtime). Typically windows would expect the BIOS clock to be set to local time but can be changed via a registry setting if running > XP (If I remember correctly). I keep the BIOS at localtime just to make sure that both OSs stay happy.
 
1 members found this post helpful.
Old 04-23-2016, 08:06 PM   #8
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Another thing to remember is that when you set one OS, then boot to the other to set it too, it is going to initially get and adjust for the boot-time settings - again - before you change things with timeconfig. This may mess up the hardware clock again for the next boot!

So boot into each one and change their configurations. Then when they all agree on the configs, reset the hardware clock to the actual current time according to those settings.

In Slackware (and other Linuces I suppose), you can force the hardware clock like this...
Code:
Setting Linux date and time:

Run timeconfig as root to set local TZ and hardware clock TZ:
timeconfig

And/or set the current local time with date (Ex: 01/30 2:55PM)
date 01301455

To set the hardware clock FROM the newly configured system clock:
hwclock --systohc
 
1 members found this post helpful.
Old 04-23-2016, 08:28 PM   #9
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,311
Blog Entries: 28

Rep: Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137
I suspect this may be the root of the issue:

Windows by default sets itself to local time. Most Linux distros by default set themselves to UTC then use the timezone setting to display local time. (Many Linux distros give you the option to choose between UTC and local time during install.)

As time settings tend to be saved to BIOS at time of shutdown, this means booting from one side of the computer to the other will change the BIOS (or equivalent) setting during shutdown, which will then affect the time on the other side of the computer during boot up.

I have encountered this and the only solution I've found it to ensure that both sides of the dual boot are set to the same time settings--not the clock settings, the underlying time settings.
 
1 members found this post helpful.
Old 04-23-2016, 10:14 PM   #10
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,367

Rep: Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748
Even if both OSes are set to use local time, this issue can also cause a problem if a local daylight saving time change occurs. I have found that that is best to first boot Windows after a daylight saving time change occurs, as Windows will automatically change the hardware clock. After that, boot Linux and it will happily accept the updated hardware clock time. If you reverse the order, the hardware clock will be updated twice, once when Linux shuts down and then again when Windows boots.
 
Old 04-24-2016, 01:10 AM   #11
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
I have set my Windows install to use UTC hardware clock which solves the issue completely. The link says it is for Windows 7 but I can confirm it works with Windows 10 also.
 
Old 04-24-2016, 11:51 PM   #12
happydog500
Member
 
Registered: Dec 2006
Location: Washington St.
Distribution: Linux Mint 21, Windows 11
Posts: 308

Original Poster
Rep: Reputation: 5
Quote:
Originally Posted by michaelk View Post
Define way off.

If the time is off by your UTC/local time offset then it is a BIOS windows / linux setting. The BIOS clock and the setting in /etc/adjtime must match (UTC vs localtime). Typically windows would expect the BIOS clock to be set to local time but can be changed via a registry setting if running > XP (If I remember correctly). I keep the BIOS at localtime just to make sure that both OSs stay happy.
If I boot to Windows at 1pm, it may say 2:30am. I think the day is off but I can't remember.

Chris.
 
Old 04-25-2016, 04:31 AM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,679

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
The CMOS battery might need to be replaced.
 
Old 04-25-2016, 09:54 AM   #14
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by happydog500 View Post
If I boot to Windows at 1pm, it may say 2:30am. I think the day is off but I can't remember.

Chris.
It's very important to pay attention to the times, write them down if you have to. If Windows claims it's 2:30 when the actual time is 1:00 (IE: the minutes are different), then that is a VERY different problem to LT vs UTC as is being discussed here. If the minutes are the same but the hours are different, then it could be LT vs UTC. You'd need to tell us what time zone you're in and what the EXACT times each OS is telling you in order to verify if that's the problem. Just a quick, "At 1:23 pm the output of `date` in Linux was XXX and the output of `date -u` in Linux was YYY, I then rebooted to Windows at 1:25pm and it claimed the time/date was ZZZ".

Last edited by suicidaleggroll; 04-25-2016 at 09:56 AM.
 
Old 04-25-2016, 12:21 PM   #15
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Running 'timeconfig' as root choosing 'UTC' or 'local time' and rebooting the clock was still incorrect.

I too like allend noticed the problem with the clock as soon as daylight savings time arrived. (spring forward)

The closest the clock was to right was running timeconfig and setting it to local time and than the clock was an hour off.
It's actually 1:00 p.m. but with local time set the clock after a reboot said 12:00 p.m.

The only thing for me that does work is to run these cmd's to fix the clock in Slackware.
Code:
date -s "12:00:00"
ntpdate time.nist.gov
hwclock --systohc
Setting the clock's first on the other 2 Linux distro's on a separate drive made no difference and a fresh reboot into Slack the clock was still wrong. For now; I'm glad that the cmd's I posted work.-
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to convert windows date and time to unix date and time jitupatil_2007 General 8 03-31-2008 05:58 AM
date and time settings Bobfurey Mandriva 3 01-19-2004 05:03 AM
Mandrake screws up date/time puzz_1 Linux - Newbie 1 06-10-2003 01:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:03 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