~ubuntu-branches/ubuntu/natty/apt/natty

« back to all changes in this revision

Viewing changes to apt-pkg/contrib/strutl.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2011-04-05 13:19:56 UTC
  • Revision ID: james.westby@ubuntu.com-20110405131956-u6sgfjr30zvy2fr3
Tags: 0.8.13.2ubuntu1
* merge fixes from debian-sid, most notable the handling of
  arch=all architectures in python-apt (LP: #733741)
* apt-pkg/aptconfiguration.cc:
  - fix comparing for a empty string

Show diffs side-by-side

added added

removed removed

Lines of Context:
692
692
   year 2000 complient and timezone neutral */
693
693
string TimeRFC1123(time_t Date)
694
694
{
695
 
   struct tm Conv = *gmtime(&Date);
 
695
   struct tm Conv;
 
696
   if (gmtime_r(&Date, &Conv) == NULL)
 
697
      return "";
 
698
 
696
699
   char Buf[300];
697
 
 
698
700
   const char *Day[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
699
701
   const char *Month[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul",
700
702
                          "Aug","Sep","Oct","Nov","Dec"};
701
703
 
702
 
   sprintf(Buf,"%s, %02i %s %i %02i:%02i:%02i GMT",Day[Conv.tm_wday],
 
704
   snprintf(Buf, sizeof(Buf), "%s, %02i %s %i %02i:%02i:%02i GMT",Day[Conv.tm_wday],
703
705
           Conv.tm_mday,Month[Conv.tm_mon],Conv.tm_year+1900,Conv.tm_hour,
704
706
           Conv.tm_min,Conv.tm_sec);
705
707
   return Buf;