@@ -72,12 +72,13 @@ seconds = do
72 case mc of
72 case mc of
73 Just '.' -> do
73 Just '.' -> do
74 t <- anyChar *> takeWhile1 isDigit
74 t <- anyChar *> takeWhile1 isDigit
75− return $! parsePicos real t
75+ return $! parsePicos (fromIntegral real) t
76 _ -> return $! fromIntegral real
76 _ -> return $! fromIntegral real
78+ parsePicos :: Int64 -> B8.ByteString -> Pico
78 parsePicos a0 t = toPico (fromIntegral (t' * 10^n))
79 parsePicos a0 t = toPico (fromIntegral (t' * 10^n))
79− where n = 12 - B8.length t
80+ where n = max 0 (12 - B8.length t)
80− t' = B8.foldl' (\a c -> 10 * a + fromIntegral (ord c) .&. 15) a0
81+ t' = B8.foldl' (\a c -> 10 * a + fromIntegral (ord c .&. 15)) a0
81 (B8.take 12 t)
82 (B8.take 12 t)
83-- | Parse a time zone, and return 'Nothing' if the offset from UTC is
84-- | Parse a time zone, and return 'Nothing' if the offset from UTC is