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 int mktime_tz(const struct hwclock_control* ctl, struct tm tm,
                     time_t* systime_p)
{
    int valid;

    if (ctl->universal)
        *systime_p = timegm(&tm);
    else
        *systime_p = mktime(&tm);
    if (*systime_p == -1)
    {
        /*
         * This apparently (not specified in mktime() documentation)
         * means the 'tm' structure does not contain valid values
         * (however, not containing valid values does _not_ imply
         * mktime() returns -1).
         */
        valid = 0;
        if (ctl->verbose)
            printf(_("Invalid values in hardware clock: "
                     "%4d/%.2d/%.2d %.2d:%.2d:%.2d\n"),
                   tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour,
                   tm.tm_min, tm.tm_sec);
    }
    else
    {
        valid = 1;
        if (ctl->verbose)
            printf(_("Hw clock time : %4d/%.2d/%.2d %.2d:%.2d:%.2d = "
                     "%ld seconds since 1969\n"),
                   tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour,
                   tm.tm_min, tm.tm_sec, (long)*systime_p);
    }
    return valid;
}
/*
 * Convert a time in broken down format (hours, minutes, etc.) into standard
 * unix time (seconds into epoch). Return it as *systime_p.
 *
 * The broken down time is argument <tm>. This broken down time is either
 * in local time zone or UTC, depending on value of logical argument
 * "universal". True means it is in UTC.
 *
 * If the argument contains values that do not constitute a valid time, and
 * mktime() recognizes this, return *valid_p == false and *systime_p
 * undefined. However, mktime() sometimes goes ahead and computes a
 * fictional time "as if" the input values were valid, e.g. if they indicate
 * the 31st day of April, mktime() may compute the time of May 1. In such a
 * case, we return the same fictional value mktime() does as *systime_p and
 * return *valid_p == true.
 */
Convert a time in broken down format (hours, minutes, etc.) into standard
unix time (seconds into epoch). Return it as *systime_p.

The broken down time is argument . This broken down time is either
in local time zone or UTC, depending on value of logical argument
"universal". True means it is in UTC.

If the argument contains values that do not constitute a valid time, and
mktime() recognizes this, return *valid_p == false and *systime_p
undefined. However, mktime() sometimes goes ahead and computes a
fictional time "as if" the input values were valid, e.g. if they indicate
the 31st day of April, mktime() may compute the time of May 1. In such a
case, we return the same fictional value mktime() does as *systime_p and
return *valid_p == true.
Convert a time in broken down format ( hours minutes etc . ) into standard unix time ( seconds into epoch ) . Return it as * systime_p . The broken down time is argument . This broken down time is either in local time zone or UTC depending on value of logical argument " universal " . True means it is in UTC . If the argument contains values that do not constitute a valid time and mktime () recognizes this return * valid_p == false and * systime_p undefined . However mktime () sometimes goes ahead and computes a fictional time " as if " the input values were valid e . g . if they indicate the 31st day of April mktime () may compute the time of May 1 . In such a case we return the same fictional value mktime () does as * systime_p and return * valid_p == true .
static int mktime_tz(const struct hwclock_control* ctl, struct tm tm,
                     time_t* systime_p)
{
    int valid;
    if (ctl->universal)
        *systime_p = timegm(&tm);
    else
        *systime_p = mktime(&tm);
    if (*systime_p == -1)
    {
        valid = 0;
        if (ctl->verbose)
            printf(_("Invalid values in hardware clock: "
                     "%4d/%.2d/%.2d %.2d:%.2d:%.2d\n"),
                   tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour,
                   tm.tm_min, tm.tm_sec);
    }
    else
    {
        valid = 1;
        if (ctl->verbose)
            printf(_("Hw clock time : %4d/%.2d/%.2d %.2d:%.2d:%.2d = "
                     "%ld seconds since 1969\n"),
                   tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour,
                   tm.tm_min, tm.tm_sec, (long)*systime_p);
    }
    return valid;
}
static int mktime_tz ( const struct hwclock_control * ctl , struct tm tm , time_t * systime_p ) { int valid ; if ( ctl -> universal ) * systime_p = timegm ( & tm ) ; else * systime_p = mktime ( & tm ) ; if ( * systime_p == -1 ) { valid = 0 ; if ( ctl -> verbose ) printf ( _ ( " " " \n " ) , tm . tm_year + 1900 , tm . tm_mon + 1 , tm . tm_mday , tm . tm_hour , tm . tm_min , tm . tm_sec ) ; } else { valid = 1 ; if ( ctl -> verbose ) printf ( _ ( " " " \n " ) , tm . tm_year + 1900 , tm . tm_mon + 1 , tm . tm_mday , tm . tm_hour , tm . tm_min , tm . tm_sec , ( long ) * systime_p ) ; } return valid ; }
Convert a time in broken down format (hours, minutes, etc.)
Convert a time in broken down format ( hours minutes etc . )
/*
         * This apparently (not specified in mktime() documentation)
         * means the 'tm' structure does not contain valid values
         * (however, not containing valid values does _not_ imply
         * mktime() returns -1).
         */