summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-05-28 12:55:21 +0200
committerJulian Andres Klode <jak@debian.org>2016-11-14 15:10:03 +0100
commit4ed2a17ab4334f019c00512aa54a162f0bf083c4 (patch)
treeb560fe018d6a0e1ed2a62ee894a265be0ea3bf52 /apt-pkg/contrib
parent78e7b683c645e907db12658405a4b201a6243ea8 (diff)
use de-localed std::put_time instead rolling our own
(cherry picked from commit eceb219c2a64f3f81421c3c6587380b6ae81a530)
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/strutl.cc14
1 files changed, 5 insertions, 9 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 26e303263..9b7162e3e 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -751,15 +751,11 @@ string TimeRFC1123(time_t Date)
if (gmtime_r(&Date, &Conv) == NULL)
return "";
- char Buf[300];
- const char *Day[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
- const char *Month[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul",
- "Aug","Sep","Oct","Nov","Dec"};
-
- snprintf(Buf, sizeof(Buf), "%s, %02i %s %i %02i:%02i:%02i GMT",Day[Conv.tm_wday],
- Conv.tm_mday,Month[Conv.tm_mon],Conv.tm_year+1900,Conv.tm_hour,
- Conv.tm_min,Conv.tm_sec);
- return Buf;
+ 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");
+ return datestr.str();
}
/*}}}*/
// ReadMessages - Read messages from the FD /*{{{*/