diff --git a/src/Ganeti/Confd/Utils.hs b/src/Ganeti/Confd/Utils.hs index 770c6f647b5b44dd9ec9dd5dcef715fa5f2e07c5..41454ce23690a2c30e883729f5069584c7b4fb36 100644 --- a/src/Ganeti/Confd/Utils.hs +++ b/src/Ganeti/Confd/Utils.hs @@ -37,7 +37,6 @@ module Ganeti.Confd.Utils import qualified Data.ByteString as B import qualified Text.JSON as J -import System.Time import Ganeti.BasicTypes import Ganeti.Confd.Types @@ -96,9 +95,3 @@ signMessage key salt msg = , signedMsgHmac = hmac } where hmac = computeMac key (Just salt) msg - --- | Returns the current time. -getCurrentTime :: IO Integer -getCurrentTime = do - TOD ctime _ <- getClockTime - return ctime diff --git a/src/Ganeti/Utils.hs b/src/Ganeti/Utils.hs index 419782645ceba62d3dad20ac11d1902f673fd89f..95f4280a549da951db500a9c4c5ac692bc8aa948 100644 --- a/src/Ganeti/Utils.hs +++ b/src/Ganeti/Utils.hs @@ -45,6 +45,7 @@ module Ganeti.Utils , exitUnless , rStripSpace , newUUID + , getCurrentTime , clockTimeToString , chompPrefix ) where @@ -290,6 +291,13 @@ newUUID = do contents <- readFile C.randomUuidFile return $! rStripSpace $ take 128 contents +-- | Returns the current time as an Integer representing the number of +-- seconds from the Unix epoch. +getCurrentTime :: IO Integer +getCurrentTime = do + TOD ctime _ <- getClockTime + return ctime + -- | Convert a ClockTime into a (seconds-only) timestamp. clockTimeToString :: ClockTime -> String clockTimeToString (TOD t _) = show t