[commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: parse %y range 1969 - 2068, bug #2671 (84f1505)

git at git.haskell.org git at git.haskell.org
Mon Feb 20 21:14:35 UTC 2017


Repository : ssh://git@git.haskell.org/time

On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis
Link       : http://git.haskell.org/packages/time.git/commitdiff/84f1505205d9edfce0315fe18cba3fa506554a85

>---------------------------------------------------------------

commit 84f1505205d9edfce0315fe18cba3fa506554a85
Author: Ashley Yakeley <ashley at semantic.org>
Date:   Sat May 7 21:36:17 2011 -0700

    parse %y range 1969 - 2068, bug #2671
    
    Ignore-this: 30d5c56ed53c337433764e109aaa5ac4
    
    darcs-hash:20110508043617-ac6dd-8e192552d6fd229ccc824600cba2bb74170ebd6a


>---------------------------------------------------------------

84f1505205d9edfce0315fe18cba3fa506554a85
 Data/Time/Format/Parse.hs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs
index aa0b66d..135fc01 100644
--- a/Data/Time/Format/Parse.hs
+++ b/Data/Time/Format/Parse.hs
@@ -254,8 +254,9 @@ instance ParseTime Day where
 
       buildDay cs = rest cs
         where
-        y = let c = safeLast 19 [x | Century x <- cs]
+        y = let 
                 d = safeLast 70 [x | Year x <- cs]
+                c = safeLast (if d >= 69 then 19 else 20) [x | Century x <- cs]
              in 100 * c + d
 
         rest (Month m:_)  = let d = safeLast 1 [x | Day x <- cs]



More information about the ghc-commits mailing list