@@ -28,7 +28,7 @@ import Database.PostgreSQL.Simple.Compat ((<>))
28import Data.Monoid(Monoid(..))
28import Data.Monoid(Monoid(..))
29import Data.Fixed (Pico)
29import Data.Fixed (Pico)
30import Unsafe.Coerce
30import Unsafe.Coerce
31−import qualified Database.PostgreSQL.Simple.Time.Parser as TP
31+import qualified Database.PostgreSQL.Simple.Time.Internal.Parser as TP
32import Database.PostgreSQL.Simple.Compat (fromPico)
32import Database.PostgreSQL.Simple.Compat (fromPico)
34data Unbounded a
34data Unbounded a
@@ -130,6 +130,7 @@ getUTCTime = TP.utcTime
130getUTCTimestamp :: A.Parser UTCTimestamp
130getUTCTimestamp :: A.Parser UTCTimestamp
131getUTCTimestamp = getUnbounded getUTCTime
131getUTCTimestamp = getUnbounded getUTCTime
133toNum :: Num n => B.ByteString -> n
134toNum :: Num n => B.ByteString -> n
134toNum = toNum_ 0
135toNum = toNum_ 0
135{-# INLINE toNum #-}
136{-# INLINE toNum #-}
@@ -149,6 +150,7 @@ digits msg = do
149 then return $! (10 * digit (c2w x) + digit (c2w y))
150 then return $! (10 * digit (c2w x) + digit (c2w y))
150 else fail (msg <> " is not 2 digits")
151 else fail (msg <> " is not 2 digits")
151{-# INLINE digits #-}
152{-# INLINE digits #-}
153dayToBuilder :: Day -> Builder
155dayToBuilder :: Day -> Builder
154dayToBuilder (toGregorian -> (y,m,d)) = do
156dayToBuilder (toGregorian -> (y,m,d)) = do
@@ -205,8 +207,8 @@ nominalDiffTimeToBuilder xyz
205 | otherwise = sign <> integerDec x <> char8 '.' <> showD6 y
207 | otherwise = sign <> integerDec x <> char8 '.' <> showD6 y
207 sign = if xyz >= 0 then mempty else char8 '-'
209 sign = if xyz >= 0 then mempty else char8 '-'
208− -- A kludge to work around the fact that Data.Fixed isn't very fast and
210+ -- A kludge to work around the fact that Data.Fixed isn't very fast and
209− -- NominalDiffTime doesn't give the MkNominalDiffTime constructor.
211+ -- NominalDiffTime doesn't give the MkNominalDiffTime constructor.
210 (x,yz) = ((unsafeCoerce (abs xyz) :: Integer) + 500000) `quotRem` 1000000000000
212 (x,yz) = ((unsafeCoerce (abs xyz) :: Integer) + 500000) `quotRem` 1000000000000
211 (fromIntegral -> y, _z) = yz `quotRem` 1000000
213 (fromIntegral -> y, _z) = yz `quotRem` 1000000