crdt 5.1 → 6.0
raw patch · 2 files changed
+6/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ CRDT.LamportClock: getRealLocalTime :: IO LocalTime
Files
- crdt.cabal +2/−2
- lib/CRDT/LamportClock.hs +4/−1
crdt.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 119c02ebf0320abefdddcca20148e0f5af6faf20dd40832108eb06a9f330705e+-- hash: 301e6350a3e473eacf8f9bbfbebaea6cb6c981e059849c0e4c7d68afd35cfe40 name: crdt-version: 5.1+version: 6.0 synopsis: Conflict-free replicated data types description: Definitions of CmRDT and CvRDT. Implementations for some classic CRDTs. category: Distributed Systems
lib/CRDT/LamportClock.hs view
@@ -15,6 +15,8 @@ -- * Real Lamport clock , LamportClock , runLamportClock+ -- * Helpers+ , getRealLocalTime ) where import Control.Concurrent.STM (TVar, atomically, modifyTVar',@@ -36,6 +38,7 @@ import Numeric.Natural (Natural) import Safe (headDef) +-- | Unix time in 10^{-7} seconds (100 ns), as in RFC 4122 and Swarm RON. type LocalTime = Natural data LamportTime = LamportTime !LocalTime !Pid@@ -73,7 +76,7 @@ in (lt', Map.insert pid lt' m) getRealLocalTime :: IO LocalTime-getRealLocalTime = round . utcTimeToPOSIXSeconds <$> getCurrentTime+getRealLocalTime = round . (* 10 ^ 7) . utcTimeToPOSIXSeconds <$> getCurrentTime getPidByMac :: IO Pid getPidByMac = Pid . decodeMac <$> getMac