.RI "Override the default " @ADJTIME_PATH@ " file path."
.
.TP
-.B \-\-badyear
-Indicate that the Hardware Clock is incapable of storing years outside
-the range 1994-1999. There is a problem in some BIOSes (almost all
-Award BIOSes made between 4/26/94 and 5/31/95) wherein they are unable
-to deal with years after 1999. If one attempts to set the year-of-century
-value to something less than 94 (or 95 in some cases), the value that
-actually gets set is 94 (or 95). Thus, if you have one of these machines,
-.B \%hwclock
-cannot set the year after 1999 and cannot use the value of the clock as
-the true time in the normal way.
-.sp
-To compensate for this (without your getting a BIOS update, which would
-definitely be preferable), always use
-.B \%\-\-badyear
-if you have one of these machines. When
-.B \%hwclock
-knows it's working with a brain-damaged clock, it ignores the year part of
-the Hardware Clock value and instead tries to guess the year based on the
-last calibrated date in the adjtime file, by assuming that date is
-within the past year. For this to work, you had better do a
-.B \%hwclock\ \-\-set
-or
-.B \%hwclock\ \-\-systohc
-at least once a year!
-.sp
-Though
-.B \%hwclock
-ignores the year value when it reads the Hardware Clock, it sets the
-year value when it sets the clock. It sets it to 1995, 1996, 1997, or
-1998, whichever one has the same position in the leap year cycle as
-the true year. That way, the Hardware Clock inserts leap days where
-they belong. Again, if you let the Hardware Clock run for more than a
-year without setting it, this scheme could be defeated and you could
-end up losing a day.
-.
-.TP
.BI \%\-\-date= date_string
This option must be used with the
.B \-\-set
.B "hwclock\ \-\-predict\ \-\-date='2525-08-14\ 07:11:05'"
.PP
The argument must be in local time, even if you keep your Hardware Clock in
-UTC. See the
+UTC. See the
.B \%\-\-localtime
option. Therefore, the argument should not include any timezone information.
It also should not be a relative time like "+5 minutes", because
*/
};
-/*
- * Almost all Award BIOS's made between 04/26/94 and 05/31/95 have a nasty
- * bug limiting the RTC year byte to the range 94-99. Any year between 2000
- * and 2093 gets changed to 2094, every time you start the system.
- *
- * With the --badyear option, we write the date to file and hope that the
- * file is updated at least once a year. I recommend putting this command
- * "hwclock --badyear" in the monthly crontab, just to be safe.
- *
- * -- Dave Coffin 11/12/98
- */
-static void write_date_to_file(struct tm *tm)
-{
- FILE *fp;
-
- if ((fp = fopen(_PATH_LASTDATE, "w"))) {
- fprintf(fp, "%02d.%02d.%04d\n", tm->tm_mday, tm->tm_mon + 1,
- tm->tm_year + 1900);
- if (close_stream(fp) != 0)
- warn(_("cannot write %s"), _PATH_LASTDATE);
- } else
- warn(_("cannot write %s"), _PATH_LASTDATE);
-}
-
-static void read_date_from_file(struct tm *tm)
-{
- int last_mday, last_mon, last_year;
- FILE *fp;
-
- if ((fp = fopen(_PATH_LASTDATE, "r"))) {
- if (fscanf(fp, "%d.%d.%d\n", &last_mday, &last_mon, &last_year)
- == 3) {
- tm->tm_year = last_year - 1900;
- if ((tm->tm_mon << 5) + tm->tm_mday <
- ((last_mon - 1) << 5) + last_mday)
- tm->tm_year++;
- }
- fclose(fp);
- }
- write_date_to_file(tm);
-}
-
/*
* time_t to timeval conversion.
*/
if (err)
return err;
- if (ctl->badyear)
- read_date_from_file(&tm);
-
if (ctl->debug)
printf(_
("Time read from Hardware Clock: %4d/%.2d/%.2d %02d:%02d:%02d\n"),
if (ctl->testing)
printf(_("Clock not changed - testing only.\n"));
else {
- if (ctl->badyear) {
- /*
- * Write the real year to a file, then write a fake
- * year between 1995 and 1998 to the RTC. This way,
- * Award BIOS boots on 29 Feb 2000 thinking that
- * it's 29 Feb 1996.
- */
- write_date_to_file(&new_broken_time);
- new_broken_time.tm_year =
- 95 + ((new_broken_time.tm_year + 1) & 3);
- }
ur->set_hardware_clock(ctl, &new_broken_time);
}
}
#endif
fprintf(usageto, _(
" --directisa access the ISA bus directly instead of %s\n"
- " --badyear ignore RTC's year because the BIOS is broken\n"
" --date <time> specifies the time to which to set the hardware clock\n"
" --epoch <year> specifies the year which is the beginning of the\n"
" hardware clock's epoch value\n"), _PATH_RTC_DEV);
/* Long only options. */
enum {
OPT_ADJFILE = CHAR_MAX + 1,
- OPT_BADYEAR,
OPT_DATE,
OPT_DIRECTISA,
OPT_EPOCH,
#endif
{ "noadjfile", no_argument, NULL, OPT_NOADJFILE },
{ "localtime", no_argument, NULL, OPT_LOCALTIME },
- { "badyear", no_argument, NULL, OPT_BADYEAR },
{ "directisa", no_argument, NULL, OPT_DIRECTISA },
{ "test", no_argument, NULL, OPT_TEST },
{ "date", required_argument, NULL, OPT_DATE },
case OPT_LOCALTIME:
ctl.local_opt = 1; /* --localtime */
break;
- case OPT_BADYEAR:
- ctl.badyear = 1;
- break;
case OPT_DIRECTISA:
ctl.directisa = 1;
break;