Revision c3a70209

b/src/Ganeti/JQueue.hs
33 33
    , queuedJobFromOpCodes
34 34
    , Timestamp
35 35
    , noTimestamp
36
    , currentTimestamp
36 37
    , opStatusFinalized
37 38
    , extractOpSummary
38 39
    , calcJobStatus
......
66 67
import System.FilePath
67 68
import System.IO.Error (isDoesNotExistError)
68 69
import System.Posix.Files
70
import System.Time
69 71
import qualified Text.JSON
70 72
import Text.JSON.Types
71 73

  
......
85 87

  
86 88
-- * Data types
87 89

  
88
-- | The ganeti queue timestamp type
90
-- | The ganeti queue timestamp type. It represents the time as the pair
91
-- of seconds since the epoch and microseconds since the beginning of the
92
-- second.
89 93
type Timestamp = (Int, Int)
90 94

  
91 95
-- | Missing timestamp type.
92 96
noTimestamp :: Timestamp
93 97
noTimestamp = (-1, -1)
94 98

  
99
-- | Get the current time in the job-queue timestamp format.
100
currentTimestamp :: IO Timestamp
101
currentTimestamp = do
102
  TOD ctime pico <- getClockTime
103
  return (fromIntegral ctime, fromIntegral $ pico `div` 1000000)
104

  
95 105
-- | An input opcode.
96 106
data InputOpCode = ValidOpCode MetaOpCode -- ^ OpCode was parsed successfully
97 107
                 | InvalidOpCode JSValue  -- ^ Invalid opcode

Also available in: Unified diff