Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | From c72ef9b6ae83a0a2fbbefd5c050335f65f0d2bc9 Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linux.intel.com> |
| 3 | Date: Tue, 22 Aug 2017 11:48:46 -0500 |
| 4 | Subject: [PATCH 2/3] Revert "use de-localed std::put_time instead rolling our |
| 5 | own" |
| 6 | |
| 7 | This reverts commit 4ed2a17ab4334f019c00512aa54a162f0bf083c4. |
| 8 | |
| 9 | After we drop debian8 and centos7 that has gcc < 5 (std::put_time not available) |
| 10 | versions this patch can be remove. |
| 11 | |
| 12 | Signed-off-by: Anibal Limon <limon.anibal@gmail.com> |
| 13 | |
| 14 | Upstream-Status: Inappropriate [embedded specific] |
| 15 | --- |
| 16 | apt-pkg/contrib/strutl.cc | 14 +++++++++----- |
| 17 | 1 file changed, 9 insertions(+), 5 deletions(-) |
| 18 | |
| 19 | diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc |
| 20 | index 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 | -- |
| 45 | 2.1.4 |
| 46 | |