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"
|
||||
- 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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue