diff --git a/src/ATrade/Types.hs b/src/ATrade/Types.hs index 6297c58..a6408fe 100644 --- a/src/ATrade/Types.hs +++ b/src/ATrade/Types.hs @@ -89,7 +89,7 @@ serializeTick tick = header : [rawdata] rawdata = toLazyByteString $ mconcat [ putWord32le 1, putWord64le $ fromIntegral . toSeconds' . timestamp $ tick, - putWord32le $ fromIntegral . floor . (* 1000000) . fracSeconds . timestamp $ tick, + putWord32le $ fromIntegral . fracSeconds . timestamp $ tick, putWord32le $ fromIntegral . fromEnum . datatype $ tick, putWord64le $ truncate . value $ tick, putWord32le $ truncate . (* 1000000000) . fractionalPart $ value tick, @@ -99,7 +99,7 @@ serializeTick tick = header : [rawdata] fractionalPart :: (RealFrac a) => a -> a fractionalPart x = x - fromIntegral (truncate x) toSeconds' t = floor $ diffUTCTime t epoch - fracSeconds t = floorPart $ diffUTCTime t epoch + fracSeconds t = (truncate $ (* 1000000000000) $ diffUTCTime t epoch) `mod` 1000000000000 `div` 1000000 epoch = fromGregorian 1970 1 1 0 0 0 diff --git a/stack.yaml b/stack.yaml index 5db2651..10d69fd 100644 --- a/stack.yaml +++ b/stack.yaml @@ -15,7 +15,7 @@ # resolver: # name: custom-snapshot # location: "./custom-snapshot.yaml" -resolver: lts-7.1 +resolver: lts-7.7 # User packages to be built. # Various formats can be used as shown in the example below.