diff --git a/Utility/TimeStamp.hs b/Utility/TimeStamp.hs index 0514529c24..cc9fcbc521 100644 --- a/Utility/TimeStamp.hs +++ b/Utility/TimeStamp.hs @@ -22,8 +22,11 @@ import System.Locale {- Parses how POSIXTime shows itself: "1431286201.113452s" - Also handles the format with no fractional seconds. -} parsePOSIXTime :: String -> Maybe POSIXTime -parsePOSIXTime s = do - let (sn, sd) = separate (== '.') s +parsePOSIXTime = uncurry parsePOSIXTime' . separate (== '.') + +{- Parses the integral and decimal part of a POSIXTime -} +parsePOSIXTime' :: String -> String -> Maybe POSIXTime +parsePOSIXTime' sn sd = do n <- readi sn if null sd then return (fromIntegral n)