diff options
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 160450366..ace74cb37 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -861,12 +861,16 @@ static time_t timegm(struct tm *t) bool RFC1123StrToTime(const char* const str,time_t &time) { struct tm Tm; + setlocale (LC_ALL,"C"); + bool const invalid = // Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 - if (strptime(str, "%a, %d %b %Y %H:%M:%S %Z", &Tm) == NULL && + (strptime(str, "%a, %d %b %Y %H:%M:%S %Z", &Tm) == NULL && // Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 strptime(str, "%A, %d-%b-%y %H:%M:%S %Z", &Tm) == NULL && // Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format - strptime(str, "%a %b %d %H:%M:%S %Y", &Tm) == NULL) + strptime(str, "%a %b %d %H:%M:%S %Y", &Tm) == NULL); + setlocale (LC_ALL,""); + if (invalid == true) return false; time = timegm(&Tm); |