From 8fbc8579f2481dc3eeb962e99522047291e16fbe Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 11 Feb 2021 06:51:21 -0500 Subject: Allow zone information to be omitted from timestamp strings --- libqpdf/QUtil.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libqpdf') diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index 39d21ea0..4b86c0d4 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -898,7 +898,7 @@ QUtil::pdf_time_to_qpdf_time(std::string const& str, QPDFTime* qtm) { static std::regex pdf_date("^D:([0-9]{4})([0-9]{2})([0-9]{2})" "([0-9]{2})([0-9]{2})([0-9]{2})" - "(?:(Z)|([\\+\\-])([0-9]{2})'([0-9]{2})')$"); + "(?:(Z?)|([\\+\\-])([0-9]{2})'([0-9]{2})')$"); std::smatch m; if (! std::regex_match(str, m, pdf_date)) { @@ -909,7 +909,7 @@ QUtil::pdf_time_to_qpdf_time(std::string const& str, QPDFTime* qtm) return QUtil::string_to_int(s.c_str()); }; - if (m[7] == "") + if (m[8] != "") { tz_delta = ((to_i(m[9]) * 60) + to_i(m[10])); -- cgit v1.2.3-70-g09d2