diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-07-02 11:28:42 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-07-02 12:01:17 +0200 |
commit | 0b45b6e5de1ba4224ced67a9952e009d0f4139a0 (patch) | |
tree | 60e8192a59d3999af3b79af62136de4ba7d310a6 /ftparchive | |
parent | f4dcab0504a68595d9e95c953ce66f46f9ad30aa (diff) | |
download | apt-0b45b6e5de1ba4224ced67a9952e009d0f4139a0.tar.gz |
use +0000 instead of UTC by default as timezone in output
All apt versions support numeric as well as 3-character timezones just
fine and its actually hard to write code which doesn't "accidently"
accepts it. So why change? Documenting the Date/Valid-Until fields in
the Release file is easy to do in terms of referencing the
datetime format used e.g. in the Debian changelogs (policy ยง4.4). This
format specifies only the numeric timezones through, not the nowadays
obsolete 3-character ones, so in the interest of least surprise we should
use the same format even through it carries a small risk of regression
in other clients (which encounter repositories created with
apt-ftparchive).
In case it is really regressing in practice, the hidden option
-o APT::FTPArchive::Release::NumericTimezone=0
can be used to go back to good old UTC as timezone.
The EDSP and EIPP protocols use this 'new' format, the text interface
used to communicate with the acquire methods does not for compatibility
reasons even if none of our methods would be effected and I doubt any
other would (in these instances the timezone is 'GMT' as that is what
HTTP/1.1 requires). Note that this is only true for apt talking to
methods, (libapt-based) methods talking to apt will respond with the
'new' format. It is therefore strongly adviced to support both also in
method input.
Diffstat (limited to 'ftparchive')
-rw-r--r-- | ftparchive/writer.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index dbeaa16a6..c34a04d1a 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -969,11 +969,15 @@ bool ContentsWriter::ReadFromPkgs(string const &PkgFile,string const &PkgCompres /* */ static std::string formatUTCDateTime(time_t const now) { + bool const NumericTimezone = _config->FindB("APT::FTPArchive::Release::NumericTimezone", true); // TimeRFC1123 uses GMT to satisfy HTTP/1.1 - std::string datetime = TimeRFC1123(now); - auto const lastspace = datetime.rfind(' '); - if (likely(lastspace != std::string::npos)) - datetime.replace(lastspace + 1, 3, "UTC"); + std::string datetime = TimeRFC1123(now, NumericTimezone); + if (NumericTimezone == false) + { + auto const lastspace = datetime.rfind(' '); + if (likely(lastspace != std::string::npos)) + datetime.replace(lastspace + 1, 3, "UTC"); + } return datetime; } ReleaseWriter::ReleaseWriter(FileFd * const GivenOutput, string const &/*DB*/) : FTWScanner(GivenOutput) |