Package-Name: hwclock
# Installed as part of util-linux under Gentoo
Gentoo-Package: sys-apps/util-linux
# ARGH put version numbers in filenames people!!!
#Source: ibibliolinux:///system/hardware/hwclock-(\d+.\d+).tgz $1
Source: http://www.ibiblio.org/pub/linux/system/hardware/hwclock.lsm/\n(Version:\s*\d+(\.\d+)+)/[\0-\377]*?Version:\s*(\d+(.\d+)+) $1 http://www.ibiblio.org/pub/linux/system/hardware/hwclock.tgz
Zap-Before-Install: 1
Repack:
	tar xzvfp "$(SOURCE)"
	mv hwclock hwclock-"$(VERSION)"
Compile:
	cp -p GPL_LICENSE.txt README "$(PREFIX)/"
	$(MAKE) -C src
	mkdir -p "$(PREFIX)"/{sbin,man/man8}
	cp -p src/hwclock "$(PREFIX)"/sbin/
	cp -p src/hwclock.8 "$(PREFIX)"/man/man8/
Install:
	mv -f "$(PREFIX)"/sbin/hwclock /sbin/
	$(MAKE) instman SECTION=8 MAN=hwclock
Patch: <<EOT
--- src/hwclock.c.old	2002-07-24 11:37:17 +0900
+++ src/hwclock.c	2002-11-21 13:02:07 +0900
@@ -307,10 +307,12 @@
        variables are the results of parsing the options and their meanings
        are given by the option_def. 
     */
-    bool show, set, systohc, hctosys, adjust, getepoch, setepoch, version;
+    bool help, show, set, systohc, hctosys, adjust, getepoch, setepoch,
+         version;
     char *date_opt, *correct_opt;
     
     optStruct option_def[] = {
+	{ 'h', (char *) "help",      OPT_FLAG,   &help,         0 },
         { 'r', (char *) "show",      OPT_FLAG,   &show,         0 },
         { 0,   (char *) "set",       OPT_FLAG,   &set,          0 },
         { 'w', (char *) "systohc",   OPT_FLAG,   &systohc,      0 },
@@ -340,7 +342,7 @@
     char **argv_parse;    /* argv, except we modify it as we parse */
     
     /* set option defaults */
-    show = set = systohc = hctosys = adjust = getepoch = setepoch = 
+    help = show = set = systohc = hctosys = adjust = getepoch = setepoch = 
         version = cmdline_p->utc = cmdline_p->local = cmdline_p->badyear =
         cmdline_p->directisa = cmdline_p->fast = cmdline_p->testing = 
         cmdline_p->debug = cmdline_p->jensen = cmdline_p->arc =
@@ -351,17 +353,49 @@
     argc_parse = argc; argv_parse = argv;
     optParseOptions(&argc_parse, argv_parse, option_def, 0);
         /* Uses and sets argc_parse, argv_parse. 
-           Sets show, set, systohc, hctosys, adjust, getepoch, setepoch,
-           version, *cmdline_p, date_opt, correct_opt,
+           Sets help, show, set, systohc, hctosys, adjust, getepoch,
+           setepoch, version, *cmdline_p, date_opt, correct_opt,
         */
   
     if (argc_parse - 1 > 0) {
         fprintf(stderr, MYNAME " takes no non-option arguments.  "
-                "You supplied %d.  See man page for complete syntax.\n",
-                argc_parse - 1);
+                "You supplied %d.  Try `hwclock --help' or see man page "
+                "for complete syntax.\n", argc_parse - 1);
         exit(100);
     }
 
+    if (help) {
+        fprintf(stderr,
+                "Usage: " MYNAME " [command] [options]\n"
+                "\n"
+                "Commands: (mutually exclusive)\n"
+                "    -r --show       Read and display current hardware clock time (default)\n"
+                "    -w --systohc    Write system clock into hardware clock\n"
+                "    -s --hctosys    Set system clock from hardware clock\n"
+                "       --set        Set hardware clock as given by --date\n"
+                "    -a --adjust     Adjust hardware clock for systematic drift\n"
+                "       --getepoch   Get kernel's hardware clock epoch value\n"
+                "       --setepoch   Set kernel's hardware clock epoch value from --epoch\n"
+                "    -v --version    Display version information\n"
+                "\n"
+                "Options:"
+                "       --date       Specify date for --set command\n"
+                "       --epoch      Specify epoch year for --setepoch command\n"
+                "    -u --utc,\n"
+                "       --localtime  Indicate that RTC stores UTC, not local time\n"
+                "       --directisa  Use direct I/O access (not /dev/rtc)\n"
+                "       --badyear    Indicate that HW clock cannot store years > 1999\n"
+                "       --correct    Specify correction for setting hardware clock\n"
+                "       --test       Test run (do not actually change anything)\n"
+                "    -D --debug      Display lots of debug information\n"
+                "    -A --arc,\n"
+                "    -J --jensen,\n"
+                "    -S --srm,\n"
+                "    -F --funky-toy  Specify type of Alpha machine\n"
+        );
+        exit(0);
+    }
+
     if (show + set + systohc + hctosys + adjust + 
         getepoch + setepoch + version > 1) {
         fprintf(stderr, 
EOT

/etc/adjtime
/pkg/hwclock/
/sbin/hwclock
/usr/man/man8/hwclock.8.gz
