From c07ebfa1e02d208ab12430e6791ea147bcfaf9c0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 7 Dec 2006 00:25:46 +0100 Subject: Imported from util-linux-2.11b tarball. --- hwclock/clock-ppc.c | 2 +- hwclock/cmos.c | 15 +++++++++++---- hwclock/hwclock.8 | 52 ++++++++++++++++++++++------------------------------ hwclock/kd.c | 2 +- hwclock/rtc.c | 2 +- 5 files changed, 36 insertions(+), 37 deletions(-) (limited to 'hwclock') diff --git a/hwclock/clock-ppc.c b/hwclock/clock-ppc.c index 6d8969adb..b73d0ad8b 100644 --- a/hwclock/clock-ppc.c +++ b/hwclock/clock-ppc.c @@ -241,7 +241,7 @@ main (int argc, char **argv ) /* If we are in MkLinux do not even bother trying to set the clock */ if(!access("/proc/osfmach3/version", R_OK)) - { // We're running MkLinux + { /* We're running MkLinux */ if ( readit | writeit | setit | adjustit ) printf("You must change the clock setting in MacOS.\n"); exit(0); diff --git a/hwclock/cmos.c b/hwclock/cmos.c index 4fc82d798..94153dea0 100644 --- a/hwclock/cmos.c +++ b/hwclock/cmos.c @@ -61,10 +61,17 @@ int inb(int c){ return 0; } #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) #define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10) +/* The epoch. + Unix uses 1900 as epoch for a struct tm, and 1970 for a time_t. + But what was written to CMOS? + Digital DECstations use 1928 - this is on a mips + Digital Unix uses 1952. + Windows NT uses 1980. + The ARC console expects to boot Windows NT and uses 1980. + (But a Ruffian uses 1900, just like SRM.) + It is reported that ALPHA_PRE_V1_2_SRM_CONSOLE uses 1958. */ #define TM_EPOCH 1900 -int cmos_epoch = 1900; /* 1980 for an alpha in ARC console time */ - /* One also sees 1952 (Digital Unix) - and 1958 (ALPHA_PRE_V1_2_SRM_CONSOLE) */ +int cmos_epoch = 1900; /* Martin Ostermann writes: The problem with the Jensen is twofold: First, it has the clock at a @@ -576,7 +583,7 @@ get_permissions_cmos(void) { } else { rc = i386_iopl(3); if (rc == -2) { - fprintf(stderr, _("I failed to get permission because I didnt try.\n")); + fprintf(stderr, _("I failed to get permission because I didn't try.\n")); } else if (rc != 0) { rc = errno; fprintf(stderr, _("%s is unable to get I/O port access: " diff --git a/hwclock/hwclock.8 b/hwclock/hwclock.8 index 7e4106d45..07c4f8cdb 100644 --- a/hwclock/hwclock.8 +++ b/hwclock/hwclock.8 @@ -53,7 +53,7 @@ what function to perform: .TP .B \-\-show Read the Hardware Clock and print the time on Standard Output. -The time is always in local time, even if you keep your Hardware Clock +The time shown is always in local time, even if you keep your Hardware Clock in Coordinated Universal Time. See the .B \-\-utc option. @@ -130,9 +130,12 @@ option. .B \-\-epoch=year Specifies the year which is the beginning of the Hardware Clock's epoch. I.e. the number of years into AD to which a zero value in the -Hardware Clock's year counter refers. +Hardware Clock's year counter refers. It is used together with +the \-\-setepoch option to set the kernel's idea of the epoch of the +Hardware Clock, or otherwise to specify the epoch for use with +direct ISA access. -For example, +For example, on a Digital Unix machine: .sp .I hwclock --setepoch --epoch=1952 @@ -226,48 +229,37 @@ whenever it finds your Hardware Clock set to 1994 or 1995. .TP .B \-\-srm +This option is equivalent to +.B \-\-epoch=1900 +and is used to specify the most common epoch on Alphas +with SRM console. .TP .B \-\-arc +This option is equivalent to +.B \-\-epoch=1980 +and is used to specify the most common epoch on Alphas +with ARC console (but Ruffians have epoch 1900). .TP .B \-\-jensen .TP .B \-\-funky\-toy -These options all tell -.B hwclock -what kind of Alpha machine you have. They -are invalid if you don't have an Alpha and shouldn't be necessary if you -do, because +These two options specify what kind of Alpha machine you have. They +are invalid if you don't have an Alpha and are usually unnecessary +if you do, because .B hwclock should be able to determine by itself what it's running on, at least when .I /proc -is mounted. These options make it possible for -.B hwclock -to work even when -its environment does not conform to its expectations and thus it cannot -accurately determine what sort of system it is running on. If you think -hwclock is incorrectly determining the system's characteristics, try -running with the -.B \-\-debug -option to see what conclusions the program is -reaching and how. If you find you need one of these options to make -.B hwclock -work, contact the +is mounted. +(If you find you need one of these options to make .B hwclock -maintainer to see if the program can be improved to detect your system -automatically. +work, contact the maintainer to see if the program can be improved +to detect your system automatically. Output of `hwclock --debug' +and `cat /proc/cpuinfo' may be of interest.) .B \-\-jensen means you are running on a Jensen model. -.B \-\-arc -means your machine uses epoch 1980 in its hardware clock, as is commonly -the case for machines on ARC console (but Ruffians have epoch 1900). - -.B \-\-srm -means your machine uses epoch 1900 in its hardware clock, as is commonly -the case for machines on SRM console. - .B \-\-funky\-toy means that on your machine, one has to use the UF bit instead of the UIP bit in the Hardware Clock to detect a time transition. "Toy" diff --git a/hwclock/kd.c b/hwclock/kd.c index fd4fdd5a1..a2f313f6d 100644 --- a/hwclock/kd.c +++ b/hwclock/kd.c @@ -124,7 +124,7 @@ set_hardware_clock_kd(const struct tm *new_broken_time) { t.wday = new_broken_time->tm_wday; if (ioctl(con_fd, KDSHWCLK, &t ) == -1) { - outsyserr(_("ioctl() to open /dev/tty1 failed")); + outsyserr(_("ioctl KDSHWCLK failed")); exit(1); } return 0; diff --git a/hwclock/rtc.c b/hwclock/rtc.c index 2874bfa14..06ac4360f 100644 --- a/hwclock/rtc.c +++ b/hwclock/rtc.c @@ -290,7 +290,7 @@ get_permissions_rtc(void) { } static struct clock_ops rtc = { - "/dev/rtc interface to clock", + RTC_DEV " interface to clock", get_permissions_rtc, read_hardware_clock_rtc, set_hardware_clock_rtc, -- cgit v1.2.3-55-g7522