module TclTime where import TclCompatibility import Char -- get the time in milliseconds -- this uses the system dependent clock clicks function -- I don't yet know a better way to do this. -- under linux clock clicks appears to give time in microseconds getTclTime :: IO Int getTclTime = do secs <- primExecuteTcl "clock clicks" return $ (parseInt secs) `div` 1000 -- ParseInt ---------------------------------------------- parseInt :: String -> Int parseInt s = case s of ' ':xs -> parseInt xs '+':xs -> parseInt xs '-':xs -> - (parseInt xs) xs -> parseInt' xs where parseInt' = foldl (\n x -> 10 * n + ((ord x) - ord '0')) 0