Copyright | (c) 2023 GYELD GMBH |
---|---|
License | Apache 2.0 |
Maintainer | [email protected] |
Stability | develop |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Synopsis
- class FormatTime t where
- formatCharacter ∷ Bool → Char → Maybe (FormatOptions → t → String)
- class ParseTime t where
- substituteTimeSpecifier ∷ Proxy t → TimeLocale → Char → Maybe String
- parseTimeSpecifier ∷ Proxy t → TimeLocale → Maybe ParseNumericPadding → Char → ReadP String
- buildTime ∷ TimeLocale → [(Char, String)] → Maybe t
- gyIso8601Show ∷ GYTime → String
- gyIso8601ParseM ∷ MonadFail m ⇒ String → m GYTime
- data GYTime
- getCurrentGYTime ∷ IO GYTime
- addSeconds ∷ GYTime → Rational → GYTime
- timeFromPlutus ∷ POSIXTime → GYTime
- timeToPlutus ∷ GYTime → POSIXTime
- timeToPOSIX ∷ GYTime → POSIXTime
- timeFromPOSIX ∷ POSIXTime → GYTime
Documentation
class FormatTime t where #
formatCharacter ∷ Bool → Char → Maybe (FormatOptions → t → String) #
Since: time-1.9.1
Instances
FormatTime DotNetTime | |
Defined in Data.Aeson.Types.Internal formatCharacter ∷ Bool → Char → Maybe (FormatOptions → DotNetTime → String) # | |
FormatTime GYTime # | |
Defined in GeniusYield.Types.Time formatCharacter ∷ Bool → Char → Maybe (FormatOptions → GYTime → String) # |
The class of types which can be parsed given a UNIX-style time format string.
substituteTimeSpecifier ∷ Proxy t → TimeLocale → Char → Maybe String #
Since: time-1.9.1
parseTimeSpecifier ∷ Proxy t → TimeLocale → Maybe ParseNumericPadding → Char → ReadP String #
Get the string corresponding to the given format specifier.
Since: time-1.9.1
∷ TimeLocale | The time locale. |
→ [(Char, String)] | Pairs of format characters and the corresponding part of the input. |
→ Maybe t |
Builds a time value from a parsed input string.
If the input does not include all the information needed to
construct a complete value, any missing parts should be taken
from 1970-01-01 00:00:00 +0000 (which was a Thursday).
In the absence of %C
or %Y
, century is 1969 - 2068.
Since: time-1.9.1
Instances
ParseTime GYTime # | |
Defined in GeniusYield.Types.Time |
gyIso8601Show ∷ GYTime → String #
>>>
gyIso8601Show (timeFromPlutus 0)
"1970-01-01T00:00:00Z"
gyIso8601ParseM ∷ MonadFail m ⇒ String → m GYTime #
>>>
gyIso8601ParseM @Maybe "1970-01-01T00:00:33.333Z"
Just (GYTime 33.333s)
>>>
gyIso8601ParseM @Maybe "1970-01-01T00:00:33.333"
Nothing
Instances
FromJSON GYTime # |
|
Defined in GeniusYield.Types.Time | |
ToJSON GYTime # |
|
IsString GYTime # |
|
Defined in GeniusYield.Types.Time fromString ∷ String → GYTime # | |
Read GYTime # | |
Show GYTime # | |
PrintfArg GYTime # |
|
Defined in GeniusYield.Types.Time | |
FromField GYTime # |
|
Defined in GeniusYield.Types.Time parseField ∷ Field → Parser GYTime # | |
ToField GYTime # |
|
Defined in GeniusYield.Types.Time | |
Eq GYTime # | |
Ord GYTime # | |
FromHttpApiData GYTime # |
|
Defined in GeniusYield.Types.Time parseUrlPiece ∷ Text → Either Text GYTime # | |
ToHttpApiData GYTime # |
|
Defined in GeniusYield.Types.Time toUrlPiece ∷ GYTime → Text # toEncodedUrlPiece ∷ GYTime → Builder # toHeader ∷ GYTime → ByteString # toQueryParam ∷ GYTime → Text # | |
ToParamSchema GYTime # | |
Defined in GeniusYield.Types.Time toParamSchema ∷ ∀ (t ∷ SwaggerKind Type). Proxy GYTime → ParamSchema t # | |
ToSchema GYTime # | |
Defined in GeniusYield.Types.Time | |
FormatTime GYTime # | |
Defined in GeniusYield.Types.Time formatCharacter ∷ Bool → Char → Maybe (FormatOptions → GYTime → String) # | |
ParseTime GYTime # | |
Defined in GeniusYield.Types.Time |
addSeconds ∷ GYTime → Rational → GYTime #
timeFromPlutus ∷ POSIXTime → GYTime #
>>>
timeFromPlutus 12345
GYTime 12.345s
timeToPlutus ∷ GYTime → POSIXTime #
>>>
timeToPlutus $ timeFromPlutus 31415
POSIXTime {getPOSIXTime = 31415}
timeToPOSIX ∷ GYTime → POSIXTime #
>>>
timeToPOSIX (timeFromPOSIX 12346)
12346s
timeFromPOSIX ∷ POSIXTime → GYTime #
>>>
timeFromPOSIX 12346
GYTime 12346s