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/misc-utils/cal.c
static int week_to_day(const struct cal_control* ctl)
{
    int yday, wday;

    wday = day_in_week(ctl, 1, JANUARY, ctl->req.year);
    yday = ctl->req.week * DAYS_IN_WEEK - wday;

    if (ctl->req.year == ctl->reform_year && yday >= YDAY_AFTER_MISSING)
        yday += NUMBER_MISSING_DAYS;

    if (ctl->weektype & WEEK_NUM_ISO)
        yday -= (wday >= FRIDAY ? -2 : 5);
    else
        yday -= 6; /* WEEK_NUM_US */
    if (yday <= 0)
        return 1;

    return yday;
}
/*
 * week_to_day
 *      return the yday of the first day in a given week inside
 *      the given year. This may be something other than Monday
 *      for ISO-8601 modes. For North American numbering this
 *      always returns a Sunday.
 */
week_to_day
return the yday of the first day in a given week inside
the given year. This may be something other than Monday
for ISO-8601 modes. For North American numbering this
always returns a Sunday.
week_to_day return the yday of the first day in a given week inside the given year . This may be something other than Monday for ISO - 8601 modes . For North American numbering this always returns a Sunday .
static int week_to_day(const struct cal_control* ctl)
{
    int yday, wday;
    wday = day_in_week(ctl, 1, JANUARY, ctl->req.year);
    yday = ctl->req.week * DAYS_IN_WEEK - wday;
    if (ctl->req.year == ctl->reform_year && yday >= YDAY_AFTER_MISSING)
        yday += NUMBER_MISSING_DAYS;
    if (ctl->weektype & WEEK_NUM_ISO)
        yday -= (wday >= FRIDAY ? -2 : 5);
    else
        yday -= 6; 
    if (yday <= 0)
        return 1;
    return yday;
}
static int week_to_day ( const struct cal_control * ctl ) { int yday , wday ; wday = day_in_week ( ctl , 1 , JANUARY , ctl -> req . year ) ; yday = ctl -> req . week * DAYS_IN_WEEK - wday ; if ( ctl -> req . year == ctl -> reform_year && yday >= YDAY_AFTER_MISSING ) yday += NUMBER_MISSING_DAYS ; if ( ctl -> weektype & WEEK_NUM_ISO ) yday -= ( wday >= FRIDAY ? -2 : 5 ) ; else yday -= 6 ; if ( yday <= 0 ) return 1 ; return yday ; }
week_to_day
      return the yday of the first day in a given week inside
      the given year.
week_to_day return the yday of the first day in a given week inside the given year .
/* WEEK_NUM_US */