conjure-0.1: src/Conjure/Utils.hs
-----------------------------------------------------------------------------
-- |
-- Module : Conjure.Utils
-- Copyright : (c) Lemmih 2006
-- License : BSD-like
--
-- Maintainer : lemmih@gmail.com
-- Stability : experimental
-- Portability : portable
--
-----------------------------------------------------------------------------
module Conjure.Utils where
import System.Time
import Control.Monad
import Control.Concurrent.STM
-- Get current time in milliseconds.
getCurrentTime :: IO Integer
getCurrentTime =
do TOD secs pico <- getClockTime
return $ secs*1000 + (pico `div` 10^(10::Int))
modifyTVar_ :: TVar a -> (a -> a) -> STM ()
modifyTVar_ tvar fn
= do var <- readTVar tvar
writeTVar tvar $! fn var