net-spider-0.3.0.0: A graph database middleware to maintain a time-varying graph.

MaintainerToshio Ito <debug.ito@gmail.com>
Safe HaskellSafe
LanguageHaskell2010

NetSpider.Timestamp

Contents

Description

 
Synopsis

The type

data Timestamp Source #

Timestamp when graph elements are observed.

Constructors

Timestamp 

Fields

Instances
Eq Timestamp Source # 
Instance details

Defined in NetSpider.Timestamp

Ord Timestamp Source #

Compare by epochTime only. timeZone is not used.

Instance details

Defined in NetSpider.Timestamp

Show Timestamp Source # 
Instance details

Defined in NetSpider.Timestamp

Construction

fromEpochMillisecond :: Int64 -> Timestamp Source #

Make Timestamp from milliseconds from the epoch. timeZone is Nothing.

Since: 0.2.0.0

now :: IO Timestamp Source #

Get the current system time.

Since: 0.2.0.0

Manipulation

addSec :: Int64 -> Timestamp -> Timestamp Source #

Add time difference (in seconds) to the Timestamp.

Since: 0.2.0.0

Conversion

parseTimestamp :: String -> Maybe Timestamp Source #

Parse a string into Timestamp. The format is like ISO8601 with a little relaxation.

>>> let timeAndOffset ts = (epochTime ts, fmap timeZoneMinutes $ timeZone ts)
>>> fmap timeAndOffset $ parseTimestamp "2018-10-11T11:20:10"
Just (1539256810000,Nothing)
>>> fmap timeAndOffset $ parseTimestamp "2018-10-11 11:20:10"
Just (1539256810000,Nothing)
>>> fmap timeAndOffset $ parseTimestamp "2015-03-23 03:33Z"
Just (1427081580000,Just 0)
>>> fmap timeAndOffset $ parseTimestamp "1999-01-05 20:34:44.211+09:00"
Just (915536084211,Just 540)
>>> fmap timeAndOffset $ parseTimestamp "2007/08/20T22:25-07:00"
Just (1187673900000,Just (-420))

Since: 0.2.0.0

fromS :: String -> Timestamp Source #

Unsafe version of parseTimestamp.

Since: 0.2.0.0

fromUTCTime :: UTCTime -> Timestamp Source #

Since: 0.2.0.0

fromLocalTime :: LocalTime -> Timestamp Source #

Covert LocalTime to Timestamp assuming it's in UTC time zone. The timeZone field is Nothing.

Since: 0.2.0.0

showEpochTime :: Timestamp -> Text Source #

Show epochTime of Timestamp as Text.

Since: 0.2.0.0