Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype Pid = Pid Word64
- class Process m => Clock m where
- data LamportTime = LamportTime LocalTime Pid
- getTime :: Clock m => m LamportTime
- type LocalTime = Natural
- class Monad m => Process m where
- data LamportClock a
- runLamportClock :: TVar LocalTime -> LamportClock a -> IO a
- getRealLocalTime :: IO LocalTime
Documentation
Unique process identifier
Lamport timestamp (for a single process)
class Process m => Clock m where Source #
:: Natural | number of needed timestamps |
-> m LamportTime | Starting value of the range.
So return value |
Get sequential timestamps.
Laws: 1. t1 <- getTimes n t2 <- getTime t2 >= t1 + n
- getTimes 0 == getTimes 1
data LamportTime Source #
getTime :: Clock m => m LamportTime Source #
type LocalTime = Natural Source #
Unix time in 10^{-7} seconds (100 ns), as in RFC 4122 and Swarm RON.
Real Lamport clock
data LamportClock a Source #
runLamportClock :: TVar LocalTime -> LamportClock a -> IO a Source #