else
/* get info from adjtime file - default is UTC */
ret = (adjtime.local_utc != LOCAL);
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("Assuming hardware clock is kept in %s time.\n"),
ret ? _("UTC") : _("local"));
return ret;
}
}
- if (ctl->debug) {
+ if (ctl->verbose) {
printf(_
("Last drift adjustment done at %ld seconds after 1969\n"),
(long)adjtime_p->last_adj_time);
{
int rc;
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("Waiting for clock tick...\n"));
rc = ur->synchronize_to_clock_tick(ctl);
- if (ctl->debug) {
+ if (ctl->verbose) {
if (rc)
printf(_("...synchronization failed\n"));
else
* mktime() returns -1).
*/
valid = 0;
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("Invalid values in hardware clock: "
"%4d/%.2d/%.2d %.2d:%.2d:%.2d\n"),
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec);
} else {
valid = 1;
- if (ctl->debug)
+ if (ctl->verbose)
printf(_
("Hw clock time : %4d/%.2d/%.2d %.2d:%.2d:%.2d = "
"%ld seconds since 1969\n"), tm.tm_year + 1900,
if (err)
return err;
- if (ctl->debug)
+ if (ctl->verbose)
printf(_
("Time read from Hardware Clock: %4d/%.2d/%.2d %02d:%02d:%02d\n"),
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour,
else
localtime_r(&newtime, &new_broken_time);
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("Setting Hardware Clock to %.2d:%.2d:%.2d "
"= %ld seconds since 1969\n"),
new_broken_time.tm_hour, new_broken_time.tm_min,
double ticksize;
/* FOR TESTING ONLY: inject random delays of up to 1000ms */
- if (ctl->debug >= 10) {
+ if (ctl->verbose >= 10) {
int usec = random() % 1000000;
printf(_("sleeping ~%d usec\n"), usec);
xusleep(usec);
prevsystime = nowsystime;
if (ticksize < 0) {
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("time jumped backward %.6f seconds "
"to %ld.%06ld - retargeting\n"),
ticksize, nowsystime.tv_sec,
/* The retarget is handled at the end of the loop. */
} else if (deltavstarget < 0) {
/* deltavstarget < 0 if current time < target time */
- if (ctl->debug >= 9)
+ if (ctl->verbose >= 9)
printf(_("%ld.%06ld < %ld.%06ld (%.6f)\n"),
nowsystime.tv_sec,
nowsystime.tv_usec,
* We missed our window. Increase the tolerance and
* aim for the next opportunity.
*/
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("missed it - %ld.%06ld is too far "
"past %ld.%06ld (%.6f > %.6f)\n"),
nowsystime.tv_sec,
+ (int)(time_diff(nowsystime, refsystime)
- RTC_SET_DELAY_SECS /* don't count this */
+ 0.5 /* for rounding */);
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("%ld.%06ld is close enough to %ld.%06ld (%.6f < %.6f)\n"
"Set RTC to %ld (%ld + %d; refsystime = %ld.%06ld)\n"),
nowsystime.tv_sec, nowsystime.tv_usec,
localtime_r(&newtime.tv_sec, &broken);
minuteswest = -get_gmtoff(&broken) / 60;
- if (ctl->debug) {
+ if (ctl->verbose) {
if (ctl->hctosys && !ctl->universal)
printf(_("Calling settimeofday(NULL, %d) to set "
"persistent_clock_is_local.\n"), minuteswest);
const struct timeval hclocktime)
{
if (!ctl->update) {
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("Not adjusting drift factor because the "
"--update-drift option was not used.\n"));
} else if (adjtime_p->last_calib_time == 0) {
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("Not adjusting drift factor because last "
"calibration time is zero,\n"
"so history is bad and calibration startover "
"is necessary.\n"));
} else if ((hclocktime.tv_sec - adjtime_p->last_calib_time) < 4 * 60 * 60) {
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("Not adjusting drift factor because it has "
"been less than four hours since the last "
"calibration.\n"));
drift_factor = adjtime_p->drift_factor + factor_adjust;
if (fabs(drift_factor) > MAX_DRIFT) {
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("Clock drift factor was calculated as "
"%f seconds/day.\n"
"It is far too much. Resetting to zero.\n"),
drift_factor);
drift_factor = 0;
} else {
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("Clock drifted %f seconds in the past "
"%f seconds\nin spite of a drift factor of "
"%f seconds/day.\n"
tdrift_p->tv_sec = (time_t) floor(exact_adjustment);
tdrift_p->tv_usec = (exact_adjustment -
(double)tdrift_p->tv_sec) * 1E6;
- if (ctl->debug) {
+ if (ctl->verbose) {
printf(P_("Time since last adjustment is %ld second\n",
"Time since last adjustment is %ld seconds\n",
(systime - last_time)),
adjtime->last_calib_time,
(adjtime->local_utc == LOCAL) ? "LOCAL" : "UTC");
- if (ctl->debug){
+ if (ctl->verbose){
printf(_("New %s data:\n%s"),
ctl->adj_file_name, content);
}
const struct timeval read_time)
{
if (adjtime_p->last_adj_time == 0) {
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("Not setting clock because last adjustment time is zero, "
"so history is bad.\n"));
} else if (fabs(adjtime_p->drift_factor) > MAX_DRIFT) {
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("Not setting clock because drift factor %f is far too high.\n"),
adjtime_p->drift_factor);
} else {
ur = probe_for_rtc_clock(ctl);
#endif
if (ur) {
- if (ctl->debug)
+ if (ctl->verbose)
puts(ur->interface_name);
} else {
- if (ctl->debug)
+ if (ctl->verbose)
printf(_("No usable clock interface found.\n"));
warnx(_("Cannot access the Hardware Clock via "
"any known method."));
- if (!ctl->debug)
- warnx(_("Use the --debug option to see the "
+ if (!ctl->verbose)
+ warnx(_("Use the --verbose option to see the "
"details of our search for an access "
"method."));
hwclock_exit(ctl, EXIT_FAILURE);
hclocktime.tv_sec, &tdrift);
hclocktime = time_inc(hclocktime, (double)
-(tdrift.tv_sec + tdrift.tv_usec / 1E6));
- if (ctl->debug) {
+ if (ctl->verbose) {
printf(_ ("Target date: %ld\n"), set_time);
printf(_ ("Predicted RTC: %ld\n"), hclocktime.tv_sec);
}
" --noadjfile do not use %1$s\n"), _PATH_ADJTIME);
printf(_(
" --adjfile <file> use an alternate file to %1$s\n"), _PATH_ADJTIME);
- puts(_(" --test dry run; implies --debug"));
- puts(_(" -D, --debug display more details"));
+ puts(_(" --test dry run; implies --verbose"));
+ puts(_(" -v, --verbose display more details"));
fputs(USAGE_SEPARATOR, stdout);
printf(USAGE_HELP_OPTIONS(22));
printf(USAGE_MAN_TAIL("hwclock(8)"));
{ "version", no_argument, NULL, 'V' },
{ "systohc", no_argument, NULL, 'w' },
{ "debug", no_argument, NULL, 'D' },
+ { "verbose", no_argument, NULL, 'v' },
{ "set", no_argument, NULL, OPT_SET },
#if defined(__linux__) && defined(__alpha__)
{ "getepoch", no_argument, NULL, OPT_GETEPOCH },
switch (c) {
case 'D':
- ctl.debug++;
+ warnx(_("use --verbose, --debug has been deprecated."));
+ break;
+ case 'v':
+ ctl.verbose++;
break;
case 'a':
ctl.adjust = 1;
break;
case OPT_TEST:
ctl.testing = 1; /* --test */
- ctl.debug++;
+ ctl.verbose++;
break;
case OPT_DATE:
ctl.date_opt = optarg; /* --date */
ctl.rtc_dev_name = optarg; /* --rtc */
break;
#endif
- case 'v': /* --version */
- case 'V':
+ case 'V': /* --version */
out_version();
return 0;
case 'h': /* --help */
}
#endif
- if (ctl.debug) {
+ if (ctl.verbose) {
out_version();
printf(_("System Time: %ld.%06ld\n"),
startup_time.tv_sec, startup_time.tv_usec);