Diff for /parser3/src/classes/date.C between versions 1.91 and 1.93

version 1.91, 2012/03/16 09:24:06 version 1.93, 2015/04/08 18:08:52
Line 112  static int to_tm_year(int iyear) { Line 112  static int to_tm_year(int iyear) {
   
         tm tmIn;  memset(&tmIn, 0, sizeof(tmIn));          tm tmIn;  memset(&tmIn, 0, sizeof(tmIn));
         tmIn.tm_isdst=-1;          tmIn.tm_isdst=-1;
         if(!month)          if(!month) {
                 if(min) {                  if(min) {
                         year=mday=0; // HH:MM                          year=mday=0; // HH:MM
                         time_t t=time(0);                          time_t t=time(0);
Line 122  static int to_tm_year(int iyear) { Line 122  static int to_tm_year(int iyear) {
                         tmIn.tm_mday=tmNow->tm_mday;                          tmIn.tm_mday=tmNow->tm_mday;
                         goto date_part_set;                          goto date_part_set;
                 } else                  } else
                         hour=min=sec=msec=0; // not YYYY- & not HH: = just YYYY                                                           hour=min=sec=msec=0; // not YYYY- & not HH: = just YYYY
           }
         tmIn.tm_year=to_tm_year(pa_atoi(year));          tmIn.tm_year=to_tm_year(pa_atoi(year));
         tmIn.tm_mon=month?pa_atoi(month)-1:0;          tmIn.tm_mon=month?pa_atoi(month)-1:0;
         tmIn.tm_mday=mday?pa_atoi(mday):1;          tmIn.tm_mday=mday?pa_atoi(mday):1;
Line 138  static void _create(Request& r, MethodPa Line 139  static void _create(Request& r, MethodPa
         VDate& vdate=GET_SELF(r, VDate);          VDate& vdate=GET_SELF(r, VDate);
   
         if(params.count()==1){          if(params.count()==1){
                 if(const String* sdate=params[0].get_string()){ // ^create[2002-04-25 18:14:00] ^create[18:14:00]                  if(params[0].is_string()){ // ^create[2002-04-25 18:14:00] ^create[18:14:00]
                         vdate.set_time(cstr_to_time_t(sdate->cstrm()));                          vdate.set_time(cstr_to_time_t(params[0].get_string()->cstrm()));
                 } else { // ^create(float days) or ^create[date object]                  } else { // ^create(float days) or ^create[date object]
                         time_t t=(time_t)round(params.as_double(0, "float days must be double", r)*SECS_PER_DAY);                          time_t t=(time_t)round(params.as_double(0, "float days must be double", r)*SECS_PER_DAY);
                         if(t<0 || !localtime(&t))                          if(t<0 || !localtime(&t))

Removed from v.1.91  
changed lines
  Added in v.1.93


E-mail: