[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
howtos:hardware:syncing_hardware_clock_and_system_local_time [2012/09/26 01:30 (UTC)] – moved from the general howtos namespace mfillpothowtos:hardware:syncing_hardware_clock_and_system_local_time [2024/02/25 20:32 (UTC)] (current) – arg -u to ntpdate in case of daemon already running drbeco
Line 1: Line 1:
-====== Feedback for accuracy ======+<!-- Reviewed 20130111 by hazel --> 
 +<!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> 
 +====== How To Sync Your System Time to Hardware Clock Consistently ======
  
-I would like people to check the accuracy of the information in this articleObviously it works for me, but if it doesn't for you, please let me know in this discussion --- //[[wiki:user:vharishankar|Harishankar]] 2012/08/25 22:21//+===== Overview ===== 
 + 
 +If you are booting multiple Linux distributions on the same machine, you might face the problem of inconsistent time zone settings across distributions. For example, assume you are dual-booting two Linux distributions, Distro X and Distro Y. You have set your BIOS hardware clock to show the local time 
 + 
 +If Distro X is configured to read the hardware clock as local time, it will show the time correctly, but if Distro Y is configured to read  the hardware clock as set to UTC, then it will show an incorrect time.  
 + 
 +This HOWTO attempts to provide a simple and cross-distribution one-time solution to the issue, making sure all your distributions know that your hardware clock is set to the local time (or UTC if you prefer it).  
 + 
 +<note tip>The other solution to time management on a system is to synchronize your computer's clock with an NTP (Network Time Protocol) server.</note> 
 + 
 +===== Procedure to Synchronize the System Time to Hardware Clock ===== 
 + 
 +This is a one-time procedure to ensure that your hardware clock's time zone is correctly and consistently recognized by all the Linux installations you multiboot on a single machine. 
 + 
 +Assuming you are dual-booting Distro X and Yfirst boot into Distribution X. First check the hardware clock with the following command. 
 +   hwclock --show     
 +If your hardware clock is not set to your local time, then you must set the system time to local time. As root, 
 + 
 +**Update via NTP:** If you installed the ntp package you can: \\ 
 +     ntpdate pool.ntp.org 
 + 
 +If you get the error ''"the NTP socket is in use, exiting"'', you probably is already running the NTP daemonIn that case, as root, use: 
 +     ntpdate -u pool.ntp.org 
 +-or\\ 
 +**Manual update:** \\ 
 +     date --set "5 Aug 2012 12:54 IST" 
 +Obviously in the above command you must set your date, time and time zone correctly. 
 + 
 +Now as root, synchronize the hardware clock to the current system time as local time. 
 +   hwclock --systohc --localtime 
 +Now the hardware clock is readjusted to the system time and both now point to the local time. 
 + 
 +<note>Obviously there are other ways to achieve the same effect, but this process is least likely to confuse as you set initial time inside the Operating System and then adjust the BIOS clock accordingly.</note>  
 + 
 +Now boot into Distro Y and follow the same steps as above. It doesn't matter that the hardware clock is now set correctly, you can still reset the clock once to make sure that every distribution you multi-boot recognizes the hardware clock as set to the local time.  
 + 
 +===== Syncing to UTC instead of Local Time ===== 
 + 
 +Some people prefer setting their hardware clock to UTC (Universal Coordinated Time) instead of local time. If you want to set your hardware clock to UTC and adjust the date/time accordingly, use the above steps but simply change the ''hwclock'' command to  
 +   hwclock --systohc --utc 
 +while setting the hardware clock from your system time. 
 + 
 +<note important>Be consistent in time settings across Operating Systems when you dual boot. If you use different settings in different Operating Systems, your local time will be messed up.</note> 
 + 
 +====== Sources ====== 
 +<!-- If you are copying information from another source, then specify that source --> 
 +  * Originally written by [[wiki:user:vharishankar|Harishankar]] for the SlackDocs Wiki Project 
 +  * Based on Harishankar's blog article [[http://harishankar.org/blog/entry.php/how-to-set-your-computer-039-s-hardware-clock-to-local-time-and-make-linux-recognize-it|here ]] 
 +<!-- Authors are allowed to give credit to themselves! --> 
 +<!-- * Originally written by [[wiki:user:xxx | User X]] --> 
 +<!-- * Contrbutions by [[wiki:user:yyy | User Y]] --> 
 + 
 +<!-- Please do not modify anything below, except adding new tags.--> 
 +<!-- You must also remove the tag-word "template" below. Otherwise your page will not show up in the Table of Contents --> 
 +{{tag>howtos time_configuration local_time system_time time hardware author_vharishankar}}
 howtos:hardware:syncing_hardware_clock_and_system_local_time ()