]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: use pointer to adjtime data
authorKarel Zak <kzak@redhat.com>
Thu, 4 Mar 2021 10:27:47 +0000 (11:27 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 4 Mar 2021 10:27:47 +0000 (11:27 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/hwclock.c

index db448687dc025aebc1a3dd7a1d4d821742d989c0..81ac64695ce2ff01da3b97440b1dfd10afe6dbda 100644 (file)
@@ -196,7 +196,7 @@ static struct timeval time_inc(struct timeval addend, double increment)
 
 static int
 hw_clock_is_utc(const struct hwclock_control *ctl,
-               const struct adjtime adjtime)
+               const struct adjtime *adjtime)
 {
        int ret;
 
@@ -206,7 +206,8 @@ hw_clock_is_utc(const struct hwclock_control *ctl,
                ret = 0;        /* --localtime explicitly given */
        else
                /* get info from adjtime file - default is UTC */
-               ret = (adjtime.local_utc != LOCAL);
+               ret = (adjtime->local_utc != LOCAL);
+
        if (ctl->verbose)
                printf(_("Assuming hardware clock is kept in %s time.\n"),
                       ret ? _("UTC") : _("local"));
@@ -1474,7 +1475,8 @@ int main(int argc, char **argv)
        } else
                /* Avoid writing adjtime file if we don't have to. */
                adjtime.dirty = 0;
-       ctl.universal = hw_clock_is_utc(&ctl, adjtime);
+
+       ctl.universal = hw_clock_is_utc(&ctl, &adjtime);
        rc = manipulate_clock(&ctl, set_time, startup_time, &adjtime);
        if (ctl.testing)
                puts(_("Test mode: nothing was changed."));