[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

¡Açò és una versió antiga del document!


Work in progess by Jordi Garcia Soler

Com sincronitzar l'hora del teu sistema de manera consistent amb el rellotge del maquinari

Perspectiva General

Si estas iniciant múltiples distribucions de Linux en la mateixa màquina, pots enfrontar-te a un problema d'inconsistència de configuració de la zona horària entre les distribucions. Per exemple, assumint que tens un arranc dual amb dos distribucions de Linux, Distribució X i Distribució Y i que has fixat el teu rellotge de maquinari de la BIOS per a que mostre l'hora local.

Si la Distribució X està configurada per a llegir el rellotge de maquinari com a hora local, mostrarà l'hora correctament, però si la Distribució Y està configurada per a llegir el rellotge de maquinari com a UTC, mostrarà una hora incorrecta.

Este COM tracta de proporcionar un solució al problema simple, única i vàlida per a totes les distribucions, assegurant-te de que totes les teues distribucions saben que al teu rellotge de maquinari està fixada l'hora local (o UTC si així ho prefereixes).

L'altra solució a la gestió de l'hora a un sistema és sincronitzar el rellotge del teu ordinador amb un servidor NTP (Network Time Protocol, Protocol d'Hora de Xarxa).

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 Y, first 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

-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.

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.

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.

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.

Sources

  • Originally written by Harishankar for the SlackDocs Wiki Project
  • Based on Harishankar's blog article here

 ca-valencia:howtos:hardware:syncing_hardware_clock_and_system_local_time ()
This translation is older than the original page and might be outdated. See what has changed.
Translations of this page?: