Commit 8b5a4b9a authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Support computation on Timestamp



As timestamps are also used to determine if an event is sufficiently
long in the past (e.g., on archiving jobs), support adding a time
interval to a Timestamp.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent ae66f3a9
......@@ -36,6 +36,7 @@ module Ganeti.JQueue
, fromClockTime
, noTimestamp
, currentTimestamp
, advanceTimestamp
, setReceivedTimestamp
, opStatusFinalized
, extractOpSummary
......@@ -63,7 +64,7 @@ module Ganeti.JQueue
) where
import Control.Applicative (liftA2, (<|>))
import Control.Arrow (second)
import Control.Arrow (first, second)
import Control.Concurrent.MVar
import Control.Exception
import Control.Monad
......@@ -117,6 +118,11 @@ fromClockTime (TOD ctime pico) =
currentTimestamp :: IO Timestamp
currentTimestamp = fromClockTime `liftM` getClockTime
-- | From a given timestamp, obtain the timestamp of the
-- time that is the given number of seconds later.
advanceTimestamp :: Int -> Timestamp -> Timestamp
advanceTimestamp = first . (+)
-- | 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