timedatectl-restorer

2017-05-15 05:55 UTC
  • Xyne

Metadata

Description:

Restore system time across reboots when the internal clock is dead.

Latest Version:

2013.7.12

Source Code:

src/

Architecture:

  • any

Dependencies:

  • python3

Optional Dependencies:

  • systemd: service support

Arch Repositories:

  • [xyne-any]
  • [xyne-i686]
  • [xyne-x86_64]

AUR Page:

timedatectl-restorer

Arch Forum Thread:

166578

Tags:

Help Message

$ timedatectl-restorer --help

usage: timedatectl-restorer [-h] [-r] [-a s] timefile runfile

Restore system time across reboots when the internal clock is dead.

positional arguments:
  timefile       The file in which to save the clock time.
  runfile        The run file to use to prevent multiple restorations in a
                 single session.

optional arguments:
  -h, --help     show this help message and exit
  -r, --restore  Restore time from file. If not set, the current time will be
                 saved instead. If the run file exists or the time file does
                 not exist then no restoration will be performed.
  -a s, --add s  The number of seconds to add to the saved time. Default: 10
                 s.

README

Introduction

This was written in response to this thread on the Arch Linux forum.

It can be used with a systemd service to restore the system clock at startup before NTP synchronized the clock.

Usage

The service is parameterized to accept a number of seconds by which to shift the shutdown time into the future. It should be at least as long as the time to shutdown and reboot the system. The ideal would be to time it to the next reboot but be conservative in estimating this. It is better to have a lagging clock than a leading clock before the time is restored to avoid consistency errors.

Once you have determined the appropriate time (e.g. 10 seconds, to be completely conservative), enable the service:

systemctl enable "timedatectl-restorer@10.service"
systemctl start "timedatectl-restorer@10.service"

The service will create a file in /run to prevent multiple restorations of the system clock in a single session if the service is restarted. Remove this file if you need to restore the clock multiple times for some reason.

Contact
echo xyne.archlinux.ca | sed 's/\./@/'
Feeds
Blog News
Validation
XHTML 1.0 Strict CSS level 3 Atom 1.0