From 6fe84c49b1787d2b692a5f4fb0587d1206d860f2 Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 25 Mar 2014 11:41:04 +0000 Subject: [PATCH] Core: ScanWwwTime 2-digit year heuristics adjusted git-svn-id: svn://ultimatepp.org/upp/trunk@7097 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/InetUtil.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/uppsrc/Core/InetUtil.cpp b/uppsrc/Core/InetUtil.cpp index 4fa097e44..9f461a6e0 100644 --- a/uppsrc/Core/InetUtil.cpp +++ b/uppsrc/Core/InetUtil.cpp @@ -10,8 +10,6 @@ String WwwFormat(Time tm) { static const char *dayofweek[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - static const char *month[] = - { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; return String().Cat() << dayofweek[DayOfWeek(tm)] << ", " << (int)tm.day << ' ' << s_www_month[tm.month - 1] @@ -41,8 +39,11 @@ bool ScanWwwTime(const char *s, Time& tm) return false; tm.month = n; tm.year = p.ReadInt(1, 4000); - if(tm.year < 100) + if(tm.year < 50) tm.year += 2000; + else + if(tm.year < 100) + tm.year += 1900; tm.hour = p.ReadInt(0, 23); p.PassChar(':'); tm.minute = p.ReadInt(0, 59);