]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: update set_system_clock comments
authorJ William Piggott <elseifthen@gmx.com>
Sun, 13 Aug 2017 00:13:22 +0000 (20:13 -0400)
committerJ William Piggott <elseifthen@gmx.com>
Thu, 24 Aug 2017 22:30:39 +0000 (18:30 -0400)
Signed-off-by: J William Piggott <elseifthen@gmx.com>
sys-utils/hwclock.c

index 0be9c2a2d2c8e4c95c2c78f3c578937bdde1df15..c398d608e17fedbe3bd51dd654ddc05b7ab43883 100644 (file)
@@ -569,20 +569,36 @@ display_time(struct timeval hwctime)
 }
 
 /*
- * Set the System Clock to time 'newtime'.
+ * Adjusts System time, sets the kernel's timezone and RTC timescale.
  *
- * Also set the kernel time zone value to the value indicated by the TZ
- * environment variable and/or /usr/lib/zoneinfo/, interpreted as tzset()
- * would interpret them.
+ * The kernel warp_clock function adjusts the System time according to the
+ * tz.tz_minuteswest argument and sets PCIL (see below). At boot settimeofday(2)
+ * has one-shot access to this function as shown in the table below.
  *
- * If this is the first call of settimeofday since boot, then this also sets
- * the kernel variable persistent_clock_is_local so that NTP 11 minute mode
- * will update the Hardware Clock with the proper timescale. If the Hardware
- * Clock's timescale configuration is changed then a reboot is required for
- * persistent_clock_is_local to be updated.
+ * +-------------------------------------------------------------------+
+ * |                       settimeofday(tv, tz)                        |
+ * |-------------------------------------------------------------------|
+ * |     Arguments     |  System Time  | PCIL |           | warp_clock |
+ * |   tv    |   tz    | set  | warped | set  | firsttime |   locked   |
+ * |---------|---------|---------------|------|-----------|------------|
+ * | pointer | NULL    |  yes |   no   |  no  |     1     |    no      |
+ * | pointer | pointer |  yes |   no   |  no  |     0     |    yes     |
+ * | NULL    | ptr2utc |  no  |   no   |  no  |     0     |    yes     |
+ * | NULL    | pointer |  no  |   yes  |  yes |     0     |    yes     |
+ * +-------------------------------------------------------------------+
+ * ptr2utc: tz.tz_minuteswest is zero (UTC).
+ * PCIL: persistent_clock_is_local, sets the "11 minute mode" timescale.
+ * firsttime: locks the warp_clock function (initialized to 1 at boot).
  *
- * If 'testing' is true, don't actually update anything -- just say we would
- * have.
+ * +---------------------------------------------------------------------------+
+ * |  op     | RTC scale | settimeofday calls                                  |
+ * |---------|-----------|-----------------------------------------------------|
+ * | systz   |   Local   | 1) warps system time*, sets PCIL* and kernel tz     |
+ * | systz   |   UTC     | 1st) locks warp_clock* 2nd) sets kernel tz          |
+ * | hctosys |   Local   | 1st) sets PCIL* 2nd) sets system time and kernel tz |
+ * | hctosys |   UTC     | 1) sets system time and kernel tz                   |
+ * +---------------------------------------------------------------------------+
+ *                         * only on first call after boot
  */
 static int
 set_system_clock(const struct hwclock_control *ctl,
@@ -631,10 +647,6 @@ set_system_clock(const struct hwclock_control *ctl,
        } else {
                const struct timezone tz = { minuteswest, 0 };
 
-               /* Set kernel persistent_clock_is_local so that 11 minute
-                * mode does not clobber the Hardware Clock with UTC. This
-                * is only available on first call of settimeofday after boot.
-                */
                if (ctl->hctosys && !ctl->universal)    /* set PCIL */
                        rc = settimeofday(tv_null, &tz);
                if (ctl->systz && ctl->universal)       /* lock warp_clock */