X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/3bdff17c894d0c3d0f813d358fc45d7a263f3552..cc9745a0d81a3e1aa5ef6f99f7ad638d26bdb950:/apt-pkg/contrib/strutl.cc diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 1d9577125..7b6bb2854 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -749,6 +749,10 @@ int StringToBool(const string &Text,int Default) /* This converts a time_t into a string time representation that is year 2000 complient and timezone neutral */ string TimeRFC1123(time_t Date) +{ + return TimeRFC1123(Date, false); +} +string TimeRFC1123(time_t Date, bool const NumericTimezone) { struct tm Conv; if (gmtime_r(&Date, &Conv) == NULL) @@ -757,7 +761,14 @@ string TimeRFC1123(time_t Date) auto const posix = std::locale("C.UTF-8"); std::ostringstream datestr; datestr.imbue(posix); - datestr << std::put_time(&Conv, "%a, %d %b %Y %H:%M:%S GMT"); + APT::StringView const fmt("%a, %d %b %Y %H:%M:%S"); + std::use_facet>(posix).put( + std::ostreambuf_iterator(datestr), + datestr, ' ', &Conv, fmt.data(), fmt.data() + fmt.size()); + if (NumericTimezone) + datestr << " +0000"; + else + datestr << " GMT"; return datestr.str(); } /*}}}*/