factor out another function
This commit is contained in:
parent
2e9f128dea
commit
3d1b22dc8e
1 changed files with 5 additions and 2 deletions
|
@ -22,8 +22,11 @@ import System.Locale
|
||||||
{- Parses how POSIXTime shows itself: "1431286201.113452s"
|
{- Parses how POSIXTime shows itself: "1431286201.113452s"
|
||||||
- Also handles the format with no fractional seconds. -}
|
- Also handles the format with no fractional seconds. -}
|
||||||
parsePOSIXTime :: String -> Maybe POSIXTime
|
parsePOSIXTime :: String -> Maybe POSIXTime
|
||||||
parsePOSIXTime s = do
|
parsePOSIXTime = uncurry parsePOSIXTime' . separate (== '.')
|
||||||
let (sn, sd) = separate (== '.') s
|
|
||||||
|
{- Parses the integral and decimal part of a POSIXTime -}
|
||||||
|
parsePOSIXTime' :: String -> String -> Maybe POSIXTime
|
||||||
|
parsePOSIXTime' sn sd = do
|
||||||
n <- readi sn
|
n <- readi sn
|
||||||
if null sd
|
if null sd
|
||||||
then return (fromIntegral n)
|
then return (fromIntegral n)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue