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 NT this gives time in milliseconds getTclTime :: IO Int getTclTime = do secs <- primExecuteTcl "clock clicks" return $ (parseInt secs) -- 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