unix-time-0.0.2: Unix time parser/formatter and utilities

Data.UnixTime

Contents

Synopsis

Data structure

data UnixTime Source

Data structure for Unix time.

Constructors

UnixTime 

Fields

utSeconds :: !CTime

Seconds from 1st Jan 1970

utMicroSeconds :: !Int32

Micro seconds (i.e. 10^(-6))

Getting time

Parsing and formatting time

parseUnixTime :: Format -> ByteString -> UnixTimeSource

Parsing ByteString to UnixTime interpreting as localtime. Zone in Format (%Z or %z) would be ignored. This is a wrapper for strptime_l().

parseUnixTimeGMT :: Format -> ByteString -> UnixTimeSource

Parsing ByteString to UnixTime interpreting as GMT. Zone in Format (%Z or %z) would be ignored. This is a wrapper for strptime_l().

formatUnixTime :: Format -> UnixTime -> ByteStringSource

Formatting UnixTime to ByteString in local time. This is a wrapper for strftime_l().

formatUnixTimeGMT :: Format -> UnixTime -> ByteStringSource

Formatting UnixTime to ByteString in GMT. This is a wrapper for strftime_l().

type Format = ByteStringSource

Format of the strptime()/strftime() style.

webDateFormat :: FormatSource

Format for web (RFC 2616). This should be used with formatUnixTimeGMT.

mailDateFormat :: FormatSource

Format for e-mail (RFC 5322). This should be used with formatUnixTime.

Difference time

data UnixDiffTime Source

Data structure for UnixTime diff.

diffUnixTime :: UnixTime -> UnixTime -> UnixDiffTimeSource

Calculating difference between two UnixTime.

secondsToUnixDiffTime :: Int -> UnixDiffTimeSource

Creating difference from seconds.

microSecondsToUnixDiffTime :: Int -> UnixDiffTimeSource

Creating difference from micro seconds.

Translating time