summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:55:29 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:55:29 +0000
commitf58a97d3de5b43fd2cf8c0928939241b7b01c67d (patch)
tree4891542955626efe83bf431c67414e4901d33e74 /apt-pkg
parent70fbac25ae36f62b99a9df1a4a7742a47a8d91ec (diff)
Moved time handling, fixed makefiles
Author: jgg Date: 1999-12-10 07:21:52 GMT Moved time handling, fixed makefiles
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/strutl.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 93a2b39cd..8e80c5efd 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: strutl.cc,v 1.30 1999/10/17 07:30:23 jgg Exp $
+// $Id: strutl.cc,v 1.31 1999/12/10 07:21:52 jgg Exp $
/* ######################################################################
String Util - Some usefull string functions.
@@ -633,7 +633,8 @@ static time_t timegm(struct tm *t)
/* This handles all 3 populare time formats including RFC 1123, RFC 1036
and the C library asctime format. It requires the GNU library function
'timegm' to convert a struct tm in UTC to a time_t. For some bizzar
- reason the C library does not provide any such function :<*/
+ reason the C library does not provide any such function :< This also
+ handles the weird, but unambiguous FTP time format*/
bool StrToTime(string Val,time_t &Result)
{
struct tm Tm;
@@ -644,6 +645,7 @@ bool StrToTime(string Val,time_t &Result)
for (;*I != 0 && *I != ' '; I++);
// Handle RFC 1123 time
+ Month[0] = 0;
if (sscanf(I," %d %3s %d %d:%d:%d GMT",&Tm.tm_mday,Month,&Tm.tm_year,
&Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec) != 6)
{
@@ -656,12 +658,19 @@ bool StrToTime(string Val,time_t &Result)
// asctime format
if (sscanf(I," %3s %d %d:%d:%d %d",Month,&Tm.tm_mday,
&Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec,&Tm.tm_year) != 6)
- return false;
+ {
+ // 'ftp' time
+ if (sscanf(I,"%4d%2d%2d%2d%2d%2d",&Tm.tm_year,&Tm.tm_mon,
+ &Tm.tm_mday,&Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec) != 6)
+ return false;
+ Tm.tm_mon--;
+ }
}
}
Tm.tm_isdst = 0;
- Tm.tm_mon = MonthConv(Month);
+ if (Month[0] != 0)
+ Tm.tm_mon = MonthConv(Month);
Tm.tm_year -= 1900;
// Convert to local time and then to GMT