blob: 088a66a3c83073e484ed4559f6eccb4c2a3965ec [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001From c72ef9b6ae83a0a2fbbefd5c050335f65f0d2bc9 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linux.intel.com>
3Date: Tue, 22 Aug 2017 11:48:46 -0500
4Subject: [PATCH 2/3] Revert "use de-localed std::put_time instead rolling our
5 own"
6
7This reverts commit 4ed2a17ab4334f019c00512aa54a162f0bf083c4.
8
9After we drop debian8 and centos7 that has gcc < 5 (std::put_time not available)
10versions this patch can be remove.
11
12Signed-off-by: Anibal Limon <limon.anibal@gmail.com>
13
14Upstream-Status: Inappropriate [embedded specific]
15---
16 apt-pkg/contrib/strutl.cc | 14 +++++++++-----
17 1 file changed, 9 insertions(+), 5 deletions(-)
18
19diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
20index c2ff01d..e9ef2be 100644
21--- a/apt-pkg/contrib/strutl.cc
22+++ b/apt-pkg/contrib/strutl.cc
23@@ -760,11 +760,15 @@ string TimeRFC1123(time_t Date)
24 if (gmtime_r(&Date, &Conv) == NULL)
25 return "";
26
27- auto const posix = std::locale::classic();
28- std::ostringstream datestr;
29- datestr.imbue(posix);
30- datestr << std::put_time(&Conv, "%a, %d %b %Y %H:%M:%S GMT");
31- return datestr.str();
32+ char Buf[300];
33+ const char *Day[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
34+ const char *Month[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul",
35+ "Aug","Sep","Oct","Nov","Dec"};
36+
37+ snprintf(Buf, sizeof(Buf), "%s, %02i %s %i %02i:%02i:%02i GMT",Day[Conv.tm_wday],
38+ Conv.tm_mday,Month[Conv.tm_mon],Conv.tm_year+1900,Conv.tm_hour,
39+ Conv.tm_min,Conv.tm_sec);
40+ return Buf;
41 }
42 /*}}}*/
43 // ReadMessages - Read messages from the FD /*{{{*/
44--
452.1.4
46