Skip to content
This repository
Browse code

Remove conversion from timestamp (no TZ) to UTCTime

  • Loading branch information...
commit ecdbc742d9d07db504a79330d5cdbfcd88a732e0 1 parent 094b560
Leon P Smith authored
14 src/Database/PostgreSQL/Simple/FromField.hs
@@ -51,8 +51,7 @@ import qualified Data.ByteString.Char8 as B
51 51 import Data.Int (Int16, Int32, Int64)
52 52 import Data.List (foldl')
53 53 import Data.Ratio (Ratio)
54   -import Data.Time ( UTCTime, ZonedTime, LocalTime, Day, TimeOfDay
55   - , localTimeToUTC, utc )
  54 +import Data.Time ( UTCTime, ZonedTime, LocalTime, Day, TimeOfDay )
56 55 import Data.Typeable (Typeable, typeOf)
57 56 import Data.Word (Word64)
58 57 import Database.PostgreSQL.Simple.Internal
@@ -194,16 +193,7 @@ instance FromField [Char] where
194 193 fromField f dat = ST.unpack <$> fromField f dat
195 194
196 195 instance FromField UTCTime where
197   - fromField f =
198   - case oid2builtin (typeOid f) of
199   - Just TimestampWithTimeZone -> doIt id parseUTCTime
200   - Just Timestamp -> doIt (localTimeToUTC utc) parseLocalTime -- deprecated
201   - _ -> const $ returnError Incompatible f ""
202   - where
203   - doIt _finish _parse Nothing
204   - = returnError UnexpectedNull f ""
205   - doIt finish parse (Just bs)
206   - = either (returnError ConversionFailed f) (pure . finish) (parse bs)
  196 + fromField = ff TimestampWithTimeZone "UTCTime" parseUTCTime
207 197
208 198 instance FromField ZonedTime where
209 199 fromField = ff TimestampWithTimeZone "ZonedTime" parseZonedTime
1  src/Database/PostgreSQL/Simple/ToField.hs
@@ -32,7 +32,6 @@ import Data.Time (Day, TimeOfDay, LocalTime, UTCTime, ZonedTime)
32 32 import Data.Typeable (Typeable)
33 33 import Data.Word (Word, Word8, Word16, Word32, Word64)
34 34 import Database.PostgreSQL.Simple.Types (Binary(..), In(..), Null)
35   -import System.Locale (defaultTimeLocale)
36 35 import qualified Blaze.ByteString.Builder.Char.Utf8 as Utf8
37 36 import qualified Data.ByteString as SB
38 37 import qualified Data.ByteString.Lazy as LB

0 comments on commit ecdbc74

Please sign in to comment.
Something went wrong with that request. Please try again.