File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ import Data.Vector (Vector)
109
109
import Data.Version (Version , parseVersion )
110
110
import Data.Word (Word16 , Word32 , Word64 , Word8 )
111
111
import Foreign.Storable (Storable )
112
+ import Foreign.C.Types (CTime (.. ))
112
113
import GHC.Generics
113
114
import Numeric.Natural (Natural )
114
115
import Text.ParserCombinators.ReadP (readP_to_S )
@@ -1347,6 +1348,9 @@ instance FromJSON Word64 where
1347
1348
instance FromJSONKey Word64 where
1348
1349
fromJSONKey = FromJSONKeyTextParser $ parseBoundedIntegralText " Word64"
1349
1350
1351
+ instance FromJSON CTime where
1352
+ parseJSON = fmap CTime . parseJSON
1353
+ {-# INLINE parseJSON #-}
1350
1354
1351
1355
instance FromJSON Text where
1352
1356
parseJSON = withText " Text" pure
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ import Data.Vector (Vector)
91
91
import Data.Version (Version , showVersion )
92
92
import Data.Word (Word16 , Word32 , Word64 , Word8 )
93
93
import Foreign.Storable (Storable )
94
+ import Foreign.C.Types (CTime (.. ))
94
95
import GHC.Generics
95
96
import Numeric.Natural (Natural )
96
97
import qualified Data.Aeson.Encoding as E
@@ -1366,7 +1367,6 @@ instance ToJSONKey Int64 where
1366
1367
toJSONKey = toJSONKeyTextEnc E. int64Text
1367
1368
{-# INLINE toJSONKey #-}
1368
1369
1369
-
1370
1370
instance ToJSON Word where
1371
1371
toJSON = Number . fromIntegral
1372
1372
{-# INLINE toJSON #-}
@@ -1426,6 +1426,12 @@ instance ToJSONKey Word64 where
1426
1426
toJSONKey = toJSONKeyTextEnc E. word64Text
1427
1427
{-# INLINE toJSONKey #-}
1428
1428
1429
+ instance ToJSON CTime where
1430
+ toJSON (CTime i) = toJSON i
1431
+ {-# INLINE toJSON #-}
1432
+
1433
+ toEncoding (CTime i) = toEncoding i
1434
+ {-# INLINE toEncoding #-}
1429
1435
1430
1436
instance ToJSON Text where
1431
1437
toJSON = String
You can’t perform that action at this time.
0 commit comments