]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: clarify set_cmos_epoch() code
authorSami Kerola <kerolasa@iki.fi>
Sat, 16 Jul 2016 19:18:19 +0000 (20:18 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sat, 4 Feb 2017 23:39:37 +0000 (23:39 +0000)
Variable set_epoc is unnecessary, and removal of it makes it obvious what is
happening in this function.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/hwclock-cmos.c

index 625da75c82cd5a5169d6efc6d71497e3253f0897..9d9a42a8b8f31026e675f76f9fbed89af85bb435 100644 (file)
@@ -178,7 +178,6 @@ static int is_in_cpuinfo(char *fmt, char *str)
 void set_cmos_epoch(const struct hwclock_control *ctl)
 {
        unsigned long epoch;
-       int set_epoc;
 
        /* Believe the user */
        if (ctl->epoch_option) {
@@ -219,25 +218,22 @@ void set_cmos_epoch(const struct hwclock_control *ctl)
         * different "epoch" ideas.
         */
        if (is_in_cpuinfo("system serial number", "MILO")) {
-               set_epoc = 1;
                if (ctl->debug)
                        printf(_("booted from MILO\n"));
+               /*
+                * See whether we are dealing with a RUFFIAN aka Alpha PC-164
+                * UX (or BX), as they have REALLY different TOY (TimeOfYear)
+                * format: BCD, and not an ARC-style epoch.  BCD is detected
+                * dynamically, but we must NOT adjust like ARC.
+                */
+               if (is_in_cpuinfo("system type", "Ruffian")) {
+                       if (debug)
+                               printf(_("Ruffian BCD clock\n"));
+                       return;
+               }
        }
 
-       /*
-        * See whether we are dealing with a RUFFIAN aka Alpha PC-164 UX (or
-        * BX), as they have REALLY different TOY (TimeOfYear) format: BCD,
-        * and not an ARC-style epoch. BCD is detected dynamically, but we
-        * must NOT adjust like ARC.
-        */
-       if (set_epoc && is_in_cpuinfo("system type", "Ruffian")) {
-               set_epoc = 0;
-               if (ctl->debug)
-                       printf(_("Ruffian BCD clock\n"));
-       }
-
-       if (set_epoc)
-               cmos_epoch = 1980;
+       cmos_epoch = 1980;
 }
 
 void set_cmos_access(const struct hwclock_control *ctl)