Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (7 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/libbb/time.c

    r2725 r3232  
    9292         * Everything but the minutes is optional
    9393         *
    94          * This coincides with the format of "touch -t TIME"
     94         * "touch -t DATETIME" format: [[[[[YY]YY]MM]DD]hh]mm[.ss]
     95         * Some, but not all, Unix "date DATETIME" commands
     96         * move [[YY]YY] past minutes mm field (!).
     97         * Coreutils date does it, and SUS mandates it.
     98         * (date -s DATETIME does not support this format. lovely!)
     99         * In bbox, this format is special-cased in date applet
     100         * (IOW: this function assumes "touch -t" format).
    95101         */
     102        unsigned cur_year = ptm->tm_year;
    96103        int len = strchrnul(date_str, '.') - date_str;
    97104
     
    134141            /* Adjust month from 1-12 to 0-11 */
    135142            ptm->tm_mon -= 1;
     143            if ((int)cur_year >= 50) { /* >= 1950 */
     144                /* Adjust year: */
     145                /* 1. Put it in the current century */
     146                ptm->tm_year += (cur_year / 100) * 100;
     147                /* 2. If too far in the past, +100 years */
     148                if (ptm->tm_year < cur_year - 50)
     149                    ptm->tm_year += 100;
     150                /* 3. If too far in the future, -100 years */
     151                if (ptm->tm_year > cur_year + 50)
     152                    ptm->tm_year -= 100;
     153            }
    136154        } else
    137155        /* ccyymmddHHMM[.SS] */
Note: See TracChangeset for help on using the changeset viewer.