File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
io-classes/si-timers/src/Control/Monad/Class/MonadTime Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -26,23 +26,27 @@ import Control.Monad.Class.MonadTime qualified as MonadTime
26
26
27
27
import NoThunks.Class (NoThunks (.. ))
28
28
29
+ import Data.Fixed (Pico , showFixed )
29
30
import Data.Time.Clock (DiffTime )
30
31
import Data.Time.Clock qualified as Time
31
32
import Data.Word (Word64 )
32
33
import GHC.Generics (Generic (.. ))
33
34
34
35
35
- -- | A point in time in a monotonic clock.
36
+ -- | A point in time in a monotonic clock counted in seconds .
36
37
--
37
38
-- The epoch for this clock is arbitrary and does not correspond to any wall
38
39
-- clock or calendar, and is /not guaranteed/ to be the same epoch across
39
40
-- program runs. It is represented as the 'DiffTime' from this arbitrary epoch.
40
41
--
41
42
newtype Time = Time DiffTime
42
- deriving stock (Eq , Ord , Show , Generic )
43
+ deriving stock (Eq , Ord , Generic )
43
44
deriving newtype NFData
44
45
deriving anyclass NoThunks
45
46
47
+ instance Show Time where
48
+ show (Time t) = " Time " ++ showFixed True (realToFrac t :: Pico )
49
+
46
50
-- | The time duration between two points in time (positive or negative).
47
51
diffTime :: Time -> Time -> DiffTime
48
52
diffTime (Time t) (Time t') = t - t'
You can’t perform that action at this time.
0 commit comments