| Copyright | (c) 2023 GYELD GMBH |
|---|---|
| License | Apache 2.0 |
| Maintainer | support@geniusyield.co |
| Stability | develop |
| Safe Haskell | None |
| Language | Haskell2010 |
GeniusYield.Types.Time
Description
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 #
Instances
| FormatTime DotNetTime | |
Defined in Data.Aeson.Types.Internal | |
| FormatTime Month | |
Defined in Data.Time.Calendar.Month.Compat | |
| FormatTime GYTime # | |
Defined in GeniusYield.Types.Time | |
The class of types which can be parsed given a UNIX-style time format string.
Minimal complete definition
Methods
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
Arguments
| ∷ 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 Methods substituteTimeSpecifier ∷ proxy GYTime → TimeLocale → Char → Maybe String # parseTimeSpecifier ∷ proxy GYTime → TimeLocale → Maybe ParseNumericPadding → Char → ReadP String # | |
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
| Eq GYTime # | |
| Ord GYTime # | |
| Read GYTime # | |
| Show GYTime # | |
| IsString GYTime # |
|
Defined in GeniusYield.Types.Time Methods fromString ∷ String → GYTime # | |
| PrintfArg GYTime # |
|
Defined in GeniusYield.Types.Time | |
| FormatTime GYTime # | |
Defined in GeniusYield.Types.Time | |
| ParseTime GYTime # | |
Defined in GeniusYield.Types.Time Methods substituteTimeSpecifier ∷ proxy GYTime → TimeLocale → Char → Maybe String # parseTimeSpecifier ∷ proxy GYTime → TimeLocale → Maybe ParseNumericPadding → Char → ReadP String # | |
| FromJSON GYTime # |
|
Defined in GeniusYield.Types.Time | |
| ToJSON GYTime # |
|
Defined in GeniusYield.Types.Time Methods toEncoding ∷ GYTime → Encoding # toJSONList ∷ [GYTime] → Value # toEncodingList ∷ [GYTime] → Encoding # | |
| ToField GYTime # |
|
Defined in GeniusYield.Types.Time | |
| FromHttpApiData GYTime # |
|
Defined in GeniusYield.Types.Time | |
| ToHttpApiData GYTime # |
|
Defined in GeniusYield.Types.Time Methods toUrlPiece ∷ GYTime → Text toEncodedUrlPiece ∷ GYTime → Builder toHeader ∷ GYTime → ByteString toQueryParam ∷ GYTime → Text | |
| FromField GYTime # |
|
Defined in GeniusYield.Types.Time Methods parseField ∷ Field → Parser GYTime | |
| ToParamSchema GYTime # | |
Defined in GeniusYield.Types.Time Methods toParamSchema ∷ ∀ (t ∷ SwaggerKind Type). Proxy GYTime → ParamSchema t | |
| ToSchema GYTime # | |
Defined in GeniusYield.Types.Time Methods declareNamedSchema ∷ Proxy GYTime → Declare (Definitions Schema) NamedSchema | |
addSeconds ∷ GYTime → Rational → GYTime #
timeFromPlutus ∷ POSIXTime → GYTime #
>>>timeFromPlutus 12345GYTime 12.345s
timeToPlutus ∷ GYTime → POSIXTime #
>>>timeToPlutus $ timeFromPlutus 31415POSIXTime {getPOSIXTime = 31415}
timeToPOSIX ∷ GYTime → POSIXTime #
>>>timeToPOSIX (timeFromPOSIX 12346)12346s
timeFromPOSIX ∷ POSIXTime → GYTime #
>>>timeFromPOSIX 12346GYTime 12346s