LGTM, thanks.
On Thu, Jan 23, 2014 at 11:01 PM, Klaus Aehlig <[email protected]> wrote: > Provide means to get Ganeti's internal timestamps > from standard clock time. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > src/Ganeti/JQueue.hs | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/src/Ganeti/JQueue.hs b/src/Ganeti/JQueue.hs > index 3ab72ee..f384de3 100644 > --- a/src/Ganeti/JQueue.hs > +++ b/src/Ganeti/JQueue.hs > @@ -33,6 +33,7 @@ module Ganeti.JQueue > , queuedJobFromOpCodes > , cancelQueuedJob > , Timestamp > + , fromClockTime > , noTimestamp > , currentTimestamp > , setReceivedTimestamp > @@ -107,11 +108,14 @@ type Timestamp = (Int, Int) > noTimestamp :: Timestamp > noTimestamp = (-1, -1) > > +-- | Obtain a Timestamp from a given clock time > +fromClockTime :: ClockTime -> Timestamp > +fromClockTime (TOD ctime pico) = > + (fromIntegral ctime, fromIntegral $ pico `div` 1000000) > + > -- | 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) > +currentTimestamp = fromClockTime `liftM` getClockTime > > -- | An input opcode. > data InputOpCode = ValidOpCode MetaOpCode -- ^ OpCode was parsed > successfully > -- > 1.8.5.3 > >
