openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/util-linux/2.33.2-r0/util-linux-2.33.2/sys-utils/hwclock.c
static void do_adjustment(const struct hwclock_control* ctl,
                          struct adjtime* adjtime_p,
                          const struct timeval hclocktime,
                          const struct timeval read_time)
{
    if (adjtime_p->last_adj_time == 0)
    {
        if (ctl->verbose)
            printf(_("Not setting clock because last adjustment time is zero, "
                     "so history is bad.\n"));
    }
    else if (fabs(adjtime_p->drift_factor) > MAX_DRIFT)
    {
        if (ctl->verbose)
            printf(_("Not setting clock because drift factor %f is far too "
                     "high.\n"),
                   adjtime_p->drift_factor);
    }
    else
    {
        set_hardware_clock_exact(
            ctl, hclocktime.tv_sec,
            time_inc(read_time, -(hclocktime.tv_usec / 1E6)));
        adjtime_p->last_adj_time = hclocktime.tv_sec;
        adjtime_p->not_adjusted = 0;
        adjtime_p->dirty = 1;
    }
}
/*
 * Do the adjustment requested, by 1) setting the Hardware Clock (if
 * necessary), and 2) updating the last-adjusted time in the adjtime
 * structure.
 *
 * Do not update anything if the Hardware Clock does not currently present a
 * valid time.
 *
 * <hclocktime> is the drift corrected time read from the Hardware Clock.
 *
 * <read_time> was the system time when the <hclocktime> was read, which due
 * to computational delay could be a short time ago. It is used to define a
 * trigger point for setting the Hardware Clock. The fractional part of the
 * Hardware clock set time is subtracted from read_time to 'refer back', or
 * delay, the trigger point.  Fractional parts must be accounted for in this
 * way, because the Hardware Clock can only be set to a whole second.
 *
 * <universal>: the Hardware Clock is kept in UTC.
 *
 * <testing>:  We are running in test mode (no updating of clock).
 *
 */
Do the adjustment requested, by 1) setting the Hardware Clock (if
necessary), and 2) updating the last-adjusted time in the adjtime
structure.

Do not update anything if the Hardware Clock does not currently present a
valid time.

 is the drift corrected time read from the Hardware Clock.

 was the system time when the  was read, which due
to computational delay could be a short time ago. It is used to define a
trigger point for setting the Hardware Clock. The fractional part of the
Hardware clock set time is subtracted from read_time to 'refer back', or
delay, the trigger point.  Fractional parts must be accounted for in this
way, because the Hardware Clock can only be set to a whole second.

: the Hardware Clock is kept in UTC.

:  We are running in test mode (no updating of clock).
Do the adjustment requested by 1 ) setting the Hardware Clock ( if necessary ) and 2 ) updating the last - adjusted time in the adjtime structure . Do not update anything if the Hardware Clock does not currently present a valid time . is the drift corrected time read from the Hardware Clock . was the system time when the was read which due to computational delay could be a short time ago . It is used to define a trigger point for setting the Hardware Clock . The fractional part of the Hardware clock set time is subtracted from read_time to ' refer back ' or delay the trigger point . Fractional parts must be accounted for in this way because the Hardware Clock can only be set to a whole second . : the Hardware Clock is kept in UTC . : We are running in test mode ( no updating of clock ) .
static void do_adjustment(const struct hwclock_control* ctl,
                          struct adjtime* adjtime_p,
                          const struct timeval hclocktime,
                          const struct timeval read_time)
{
    if (adjtime_p->last_adj_time == 0)
    {
        if (ctl->verbose)
            printf(_("Not setting clock because last adjustment time is zero, "
                     "so history is bad.\n"));
    }
    else if (fabs(adjtime_p->drift_factor) > MAX_DRIFT)
    {
        if (ctl->verbose)
            printf(_("Not setting clock because drift factor %f is far too "
                     "high.\n"),
                   adjtime_p->drift_factor);
    }
    else
    {
        set_hardware_clock_exact(
            ctl, hclocktime.tv_sec,
            time_inc(read_time, -(hclocktime.tv_usec / 1E6)));
        adjtime_p->last_adj_time = hclocktime.tv_sec;
        adjtime_p->not_adjusted = 0;
        adjtime_p->dirty = 1;
    }
}
static void do_adjustment ( const struct hwclock_control * ctl , struct adjtime * adjtime_p , const struct timeval hclocktime , const struct timeval read_time ) { if ( adjtime_p -> last_adj_time == 0 ) { if ( ctl -> verbose ) printf ( _ ( " " " \n " ) ) ; } else if ( fabs ( adjtime_p -> drift_factor ) > MAX_DRIFT ) { if ( ctl -> verbose ) printf ( _ ( " " " \n " ) , adjtime_p -> drift_factor ) ; } else { set_hardware_clock_exact ( ctl , hclocktime . tv_sec , time_inc ( read_time , - ( hclocktime . tv_usec / 1E6 ) ) ) ; adjtime_p -> last_adj_time = hclocktime . tv_sec ; adjtime_p -> not_adjusted = 0 ; adjtime_p -> dirty = 1 ; } }
Do the adjustment requested, by 1) setting the Hardware Clock (if
 necessary), and 2) updating the last-adjusted time in the adjtime
 structure.
Do the adjustment requested by 1 ) setting the Hardware Clock ( if necessary ) and 2 ) updating the last - adjusted time in the adjtime structure .