@node hwclockfile directive
@subsection hwclockfile
The @code{hwclockfile} directive sets the location of the adjtime file which is
-used by the @file{/sbin/hwclock} program. With this directive, @code{chronyd}
-will parse the file to find out if the RTC keeps local time or UTC. It
-overrides the @code{rtconutc} directive (@pxref{rtconutc directive}).
+used by the @file{/sbin/hwclock} program on Linux. @code{chronyd} parses the
+file to find out if the RTC keeps local time or UTC. It overrides the
+@code{rtconutc} directive (@pxref{rtconutc directive}).
+
+The default value is @file{@DEFAULT_HWCLOCK_FILE@}.
An example of the command is
static int rtc_on_utc = 0;
/* Filename used to read the hwclock(8) LOCAL/UTC setting */
-static char *hwclock_file = NULL;
+static char *hwclock_file;
/* Flag set if the RTC should be automatically synchronised by kernel */
static int rtc_sync = 0;
bind_cmd_path = Strdup(DEFAULT_COMMAND_SOCKET);
pidfile = Strdup("/var/run/chronyd.pid");
rtc_device = Strdup("/dev/rtc");
+ hwclock_file = Strdup(DEFAULT_HWCLOCK_FILE);
user = Strdup(DEFAULT_USER);
}
--with-ntp-era=SECONDS Specify earliest assumed NTP time in seconds
since 1970-01-01 [50*365 days ago]
--with-user=USER Specify default chronyd user [root]
+ --with-hwclockfile=PATH Specify default path to hwclock(8) adjtime file
--with-sendmail=PATH Path to sendmail binary [/usr/lib/sendmail]
--enable-debug Enable debugging support
feat_forcednsretry=1
ntp_era_split=""
default_user="root"
+default_hwclockfile=""
mail_program="/usr/lib/sendmail"
for option
--with-user=* )
default_user=`echo $option | sed -e 's/^.*=//;'`
;;
+ --with-hwclockfile=* )
+ default_hwclockfile=`echo $option | sed -e 's/^.*=//;'`
+ ;;
--with-sendmail=* )
mail_program=`echo $option | sed -e 's/^.*=//;'`
;;
fi
add_def DEFAULT_CONF_FILE "\"$SYSCONFDIR/chrony.conf\""
+add_def DEFAULT_HWCLOCK_FILE "\"$default_hwclockfile\""
add_def DEFAULT_USER "\"$default_user\""
add_def DEFAULT_COMMAND_SOCKET "\"$CHRONYSOCKDIR/chronyd.sock\""
add_def MAIL_PROGRAM "\"$mail_program\""
s%@LOCALSTATEDIR@%${LOCALSTATEDIR}%;\
s%@CHRONYSOCKDIR@%${CHRONYSOCKDIR}%;\
s%@CHRONYVARDIR@%${CHRONYVARDIR}%;\
+ s%@DEFAULT_HWCLOCK_FILE@%${default_hwclockfile}%;\
s%@DEFAULT_USER@%${default_user}%;"\
< ${f}.in > $f
done
char line[256];
int i;
- if (!hwclock_file)
+ if (!hwclock_file || !hwclock_file[0])
return;
in = fopen(hwclock_file, "r");