on master help sign in
fix more bugs in stepTime
commitcad54a8bcc433dc926d90cf40cd66a0c4f592ddf authorMark Lentczner <markl@glyphic.com> dateMon 28 Dec 2009, 06:16 (17 years ago) parenta12d7bd
1 file changed+4−4
Data/UUID/V1.hs+4−4
Data/UUID/V1.hs+4−4
@@ -65,15 +65,15 @@ stepTime = do
6565 h1 <- fmap hundredsOfNanosSinceGregorianReform getCurrentTime
6666 if h1 > h0
6767 then do
68− writeIORef state $ State 0 h1
68+ writeIORef state $ State c0 h1
6969 return $ Just (c0, h1)
7070 else do
7171 let
7272 c1 = succ c0
7373 if c1 < 2^14
7474 then do
75− writeIORef state $ State c1 h0
76− return $ Just (c1, h0)
75+ writeIORef state $ State c1 h1
76+ return $ Just (c1, h1)
7777 else do
7878 return Nothing
7979
@@ -81,7 +81,7 @@ stepTime = do
8181{-# NOINLINE state #-}
8282state = unsafePerformIO $ do
8383 h0 <- fmap hundredsOfNanosSinceGregorianReform getCurrentTime
84− newIORef $ State 0 h0
84+ newIORef $ State 0 h0 -- the 0 should be a random number
8585
8686
8787data State = State