Mantis - Quercus
Viewing Issue Advanced Details
2163 major always 11-10-07 21:03 11-14-07 21:07
catkins  
nam  
normal  
closed 3.0.23  
fixed  
none    
none 3.1.4  
0002163: mktime
mktime does not conform to behavior required for out-of-range values. See below for new version that passes examples given on php documentation.
  /**
   * Returns the formatted date.
   */
  public long mktime(Env env,
                     @Optional("-1") int hour,
             @Optional("-1") int minute,
             @Optional("-1") int second,
             @Optional("-1") int month,
             @Optional("-2147483648") int day,
             @Optional("-1") int year,
                     @Optional("-1") int isDST)
  {
    if (isDST != -1)
      env.deprecatedArgument("isDST");

    QDate date = new QDate(true);

    long now = Alarm.getCurrentTime();

    date.setLocalTime(now);

    if (year >= 0 && year <= 69)
        year += 2000;
    else if (year >= 70 && year <= 100)
        year += 1900;

    if (year > 0)
      date.setYear(year);

    if (month > 0)
      date.setMonth(month - 1);

    if (day != -2147483648)
      date.setDayOfMonth(day);

    if (hour >= 0)
      date.setHour(hour);

    if (minute >= 0)
      date.setMinute(minute);

    if (second >= 0)
      date.setSecond(second);

    return date.getGMTTime() / 1000L;
  }


Notes
(0002495)
nam   
11-14-07 21:07   
php/190m