Commit c3a70209 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Document the jobqueue timestamp format



...and also provide a method to get the current time in
that format.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 5eeb7168
......@@ -33,6 +33,7 @@ module Ganeti.JQueue
, queuedJobFromOpCodes
, Timestamp
, noTimestamp
, currentTimestamp
, opStatusFinalized
, extractOpSummary
, calcJobStatus
......@@ -66,6 +67,7 @@ import System.Directory
import System.FilePath
import System.IO.Error (isDoesNotExistError)
import System.Posix.Files
import System.Time
import qualified Text.JSON
import Text.JSON.Types
......@@ -85,13 +87,21 @@ import Ganeti.Utils
-- * Data types
-- | The ganeti queue timestamp type
-- | The ganeti queue timestamp type. It represents the time as the pair
-- of seconds since the epoch and microseconds since the beginning of the
-- second.
type Timestamp = (Int, Int)
-- | Missing timestamp type.
noTimestamp :: Timestamp
noTimestamp = (-1, -1)
-- | Get the current time in the job-queue timestamp format.
currentTimestamp :: IO Timestamp
currentTimestamp = do
TOD ctime pico <- getClockTime
return (fromIntegral ctime, fromIntegral $ pico `div` 1000000)
-- | An input opcode.
data InputOpCode = ValidOpCode MetaOpCode -- ^ OpCode was parsed successfully
| InvalidOpCode JSValue -- ^ Invalid opcode
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment