ganeti-3.1: Cluster-based virtualization management software
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ganeti.Utils.Time

Description

Time utility functions.

Synopsis

Documentation

getCurrentTime :: IO Integer #

Returns the current time as an Integer representing the number of seconds from the Unix epoch.

getCurrentTimeUSec :: IO Integer #

Returns the current time as an Integer representing the number of microseconds from the Unix epoch (hence the need for Integer).

clockTimeToString :: ClockTime -> String #

Convert a ClockTime into a (seconds-only) timestamp.

clockTimeToCTime :: ClockTime -> EpochTime #

Convert a ClockTime into a (seconds-only) EpochTime (AKA time_t).

clockTimeToUSec :: ClockTime -> Integer #

Convert a ClockTime the number of microseconds since the epoch.

cTimeToClockTime :: EpochTime -> ClockTime #

Convert a ClockTime into a (seconds-only) EpochTime (AKA time_t).

diffClockTimes :: ClockTime -> ClockTime -> TimeDiff #

addToClockTime :: TimeDiff -> ClockTime -> ClockTime #

data TimeDiff #

Like TimeDiff but misses tdYear, tdMonth. Their meaning depends on the start date and causes bugs like this one: https://github.com/haskell/old-time/issues/18 This type is much simpler and less error-prone. Also, our tdSec has type Integer, which cannot overflow. Like in original TimeDiff picoseconds can be negative, that is, TimeDiff's are not normalized by default.

Constructors

TimeDiff 

Fields

Instances

Instances details
Show TimeDiff # 
Instance details

Defined in Ganeti.Utils.Time

Methods

showsPrec :: Int -> TimeDiff -> ShowS

show :: TimeDiff -> String

showList :: [TimeDiff] -> ShowS