git.iko.soy/typeable/postgresql-simple
on master help sign in
Allow optional seconds when parsing of time of day

This is to match aeson HEAD

commitfe5e16c1e3eeef2ade01d9ef689614076a137168 authorLeon P Smith <leon@melding-monads.com> dateFri 15 Jan 2016, 05:51 (11 years ago) parentc3262a5
1 file changed+6−3
src/Database/PostgreSQL/Simple/Time/Internal/Parser.hs+6−3
src/Database/PostgreSQL/Simple/Time/Internal/Parser.hs+6−3
@@ -52,12 +52,15 @@ twoDigits = do
5252 let c2d c = ord c .&. 15
5353 return $! c2d a * 10 + c2d b
5454
55−-- | Parse a time of the form @HH:MM:SS[.SSS]@.
55+-- | Parse a time of the form @HH:MM[:SS[.SSS]]@.
5656timeOfDay :: Parser Local.TimeOfDay
5757timeOfDay = do
5858 h <- twoDigits <* char ':'
59− m <- twoDigits <* char ':'
60− s <- seconds
59+ m <- twoDigits
60+ mc <- peekChar
61+ s <- case mc of
62+ Just ':' -> anyChar *> seconds
63+ _ -> return 0
6164 if h < 24 && m < 60 && s <= 60
6265 then return (Local.TimeOfDay h m s)
6366 else fail "invalid time"