lambdabot-core-5.3.1.2: Lambdabot core functionality

Safe Haskell | Safe-Inferred
Language | Haskell98

Lambdabot.Compat.AltTime

Description

Time compatibility layer (stuff to support old lambdabot state serialization formats)

TODO: trim this down to just the explicitly serialization-related stuff

Synopsis

- data ClockTime
- getClockTime :: IO ClockTime
- diffClockTimes :: ClockTime -> ClockTime -> TimeDiff
- addToClockTime :: TimeDiff -> ClockTime -> ClockTime
- timeDiffPretty :: TimeDiff -> String
- newtype TimeDiff = TimeDiff NominalDiffTime
- noTimeDiff :: TimeDiff

# Documentation

data ClockTime Source #

Wrapping ClockTime (which doesn't provide a Read instance!) seems easier than talking care of the serialization of UserStatus ourselves.

#### Instances

Instances details

Binary ClockTime Source # |
Instance details Defined in Lambdabot.Compat.AltTime Methods put :: ClockTime -> Put Source # get :: Get ClockTime Source # putList :: [ClockTime] -> Put Source #
Read ClockTime Source # |
Instance details Defined in Lambdabot.Compat.AltTime Methods readsPrec :: Int -> ReadS ClockTime Source # readList :: ReadS [ClockTime] Source # readPrec :: ReadPrec ClockTime Source # readListPrec :: ReadPrec [ClockTime] Source #
Show ClockTime Source # |
Instance details Defined in Lambdabot.Compat.AltTime Methods showsPrec :: Int -> ClockTime -> ShowS Source # show :: ClockTime -> String Source # showList :: [ClockTime] -> ShowS Source #
Eq ClockTime Source # |
Instance details Defined in Lambdabot.Compat.AltTime Methods (==) :: ClockTime -> ClockTime -> Bool Source # (/=) :: ClockTime -> ClockTime -> Bool Source #

getClockTime :: IO ClockTime Source #

Retrieve the current clocktime

diffClockTimes :: ClockTime -> ClockTime -> TimeDiff Source #

Difference of two clock times

addToClockTime :: TimeDiff -> ClockTime -> ClockTime Source #

``addToClockTime` d t` adds a time difference `d` and a -- clock time `t` to yield a new clock time.

timeDiffPretty :: TimeDiff -> String Source #

Pretty-print a TimeDiff. Both positive and negative Timediffs produce the same output.

14d 17h 8m 53s

newtype TimeDiff Source #

Constructors

TimeDiff NominalDiffTime |

#### Instances

Instances details

Binary TimeDiff Source # |
Instance details Defined in Lambdabot.Compat.AltTime Methods put :: TimeDiff -> Put Source # get :: Get TimeDiff Source # putList :: [TimeDiff] -> Put Source #
Read TimeDiff Source # |
Instance details Defined in Lambdabot.Compat.AltTime Methods readsPrec :: Int -> ReadS TimeDiff Source # readList :: ReadS [TimeDiff] Source # readPrec :: ReadPrec TimeDiff Source # readListPrec :: ReadPrec [TimeDiff] Source #
Show TimeDiff Source # |
Instance details Defined in Lambdabot.Compat.AltTime Methods showsPrec :: Int -> TimeDiff -> ShowS Source # show :: TimeDiff -> String Source # showList :: [TimeDiff] -> ShowS Source #
Eq TimeDiff Source # |
Instance details Defined in Lambdabot.Compat.AltTime Methods (==) :: TimeDiff -> TimeDiff -> Bool Source # (/=) :: TimeDiff -> TimeDiff -> Bool Source #
Ord TimeDiff Source # |
Instance details Defined in Lambdabot.Compat.AltTime Methods compare :: TimeDiff -> TimeDiff -> Ordering Source # (<) :: TimeDiff -> TimeDiff -> Bool Source # (<=) :: TimeDiff -> TimeDiff -> Bool Source # (>) :: TimeDiff -> TimeDiff -> Bool Source # (>=) :: TimeDiff -> TimeDiff -> Bool Source # max :: TimeDiff -> TimeDiff -> TimeDiff Source # min :: TimeDiff -> TimeDiff -> TimeDiff Source #

noTimeDiff :: TimeDiff Source #