[BACK]Return to date.y CVS log [TXT][DIR] Up to [local] / src / usr.bin / cvs

Diff for /src/usr.bin/cvs/date.y between version 1.18 and 1.19

version 1.18, 2008/02/16 01:00:00 version 1.19, 2010/07/23 09:11:10
Line 807 
Line 807 
 time_t  time_t
 cvs_date_parse(const char *p)  cvs_date_parse(const char *p)
 {  {
         struct tm       gmt, *gmt_ptr, *tm;          struct tm       gmt, tm;
         struct timeb    ftz, *now;          time_t          Start, tod, nowtime, tz;
         time_t          Start, tod, nowtime;  
   
         yyInput = p;          yyInput = p;
   
         now = &ftz;          if (time(&nowtime) == -1 || !gmtime_r(&nowtime, &gmt) ||
         (void)time(&nowtime);              !localtime_r(&nowtime, &tm))
                   fatal("cvs_date_parse failed");
   
         gmt_ptr = gmtime(&nowtime);          tz = difftm(&gmt, &tm) / 60;
         if (gmt_ptr != NULL) {  
                 /* Make a copy, in case localtime modifies *tm (I think  
                  * that comment now applies to *gmt_ptr, but I am too  
                  * lazy to dig into how gmtime and locatime allocate the  
                  * structures they return pointers to).  
                  */  
                 gmt = *gmt_ptr;  
         }  
   
         if (!(tm = localtime(&nowtime)))          if (tm.tm_isdst)
                 return (-1);                  tz += 60;
   
         if (gmt_ptr != NULL)          yyYear = tm.tm_year + 1900;
                 ftz.timezone = difftm(&gmt, tm) / 60;          yyMonth = tm.tm_mon + 1;
           yyDay = tm.tm_mday;
         if (tm->tm_isdst)          yyTimezone = tz;
                 ftz.timezone += 60;  
   
         tm = localtime(&nowtime);  
         yyYear = tm->tm_year + 1900;  
         yyMonth = tm->tm_mon + 1;  
         yyDay = tm->tm_mday;  
         yyTimezone = now->timezone;  
         yyDSTmode = DSTmaybe;          yyDSTmode = DSTmaybe;
         yyHour = 0;          yyHour = 0;
         yyMinutes = 0;          yyMinutes = 0;
Line 865 
Line 850 
         } else {          } else {
                 Start = nowtime;                  Start = nowtime;
                 if (!yyHaveRel)                  if (!yyHaveRel)
                         Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) +                          Start -= ((tm.tm_hour * 60L + tm.tm_min) * 60L) +
                             tm->tm_sec;                              tm.tm_sec;
         }          }
   
         Start += yyRelSeconds;          Start += yyRelSeconds;

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19