module Hasql.Pool.TimeExtras.Conversions where

import Hasql.Pool.Prelude

class ToMilliseconds a where
  toMilliseconds :: a -> Int

instance ToMilliseconds SystemTime where
  toMilliseconds :: SystemTime -> Int
toMilliseconds (MkSystemTime Int64
s Word32
ns) =
    forall a b. (Integral a, Num b) => a -> b
fromIntegral Int64
s forall a. Num a => a -> a -> a
* Int
1000 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Integral a => a -> a -> a
div Word32
ns Word32
1000000)