Find the answer to your Linux question:
Results 1 to 3 of 3
in linux there is a system clock. and the computer has a hardware clock.. these two are in sync when the system boots up.. suppose i change the system clock.. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    May 2005
    Location
    Chennai,TamilNadu, India
    Posts
    141

    time sync in linux


    in linux there is a system clock. and the computer has a hardware clock..

    these two are in sync when the system boots up..

    suppose i change the system clock.. and before i give the command to sync the two clocks (ie. hardware and system), the machine undergoes an unclean shutdown.

    on the next reboot i see that the hardware clock time has been taken as the system clock time.

    so isnt there a amibiguity of the times of files getting changed?? i know this is the user's fault to some extent.. but does linux have any mechanism that syncs these two clocks automatically other than manually having to enter the command

    Code:
    /sbin/hwclock --systohc
    just a thought...thats all

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Normally, the system clock time is copied into the hardware clock at system shutdown, by some of the shutdown scripts.

    In Gentoo (and maybe other distros as well), that behavior can be changed in /etc/conf.d/clock:
    Quote Originally Posted by /etc/conf.d/clock
    Code:
    ...
    
    # If you want to set the Hardware Clock to the current System Time 
    # during shutdown, then say "yes" here.
    
    CLOCK_SYSTOHC="yes"
    
    ...

  3. #3
    Linux Newbie
    Join Date
    May 2005
    Location
    Chennai,TamilNadu, India
    Posts
    141
    i guess what u have told me now is about a clean shutdown... i knew about the resync of time to hardware clock during an clean shutdown.

    In fedora this happens automcatically. i have to check the shutdown script to see the code

    but what about an unclean shutdown??

    i guess i can keep a script in cron which runs and checks if the hardware and system clock are in sync and if not to make them in sync

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •