Copyright | (c) 2023 GYELD GMBH |
---|---|
License | Apache 2.0 |
Maintainer | [email protected] |
Stability | develop |
Safe Haskell | None |
Language | GHC2021 |
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 Methods formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> DotNetTime -> String) # | |
FormatTime GYTime # | |
Defined in GeniusYield.Types.Time Methods formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> GYTime -> String) # |
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 # buildTime :: TimeLocale -> [(Char, String)] -> Maybe GYTime # |
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 # |
|
PrintfArg GYTime # |
|
Defined in GeniusYield.Types.Time | |
FromField GYTime # |
|
Defined in GeniusYield.Types.Time Methods parseField :: Field -> Parser GYTime # | |
ToField GYTime # |
|
Defined in GeniusYield.Types.Time | |
IsString GYTime # |
|
Defined in GeniusYield.Types.Time Methods fromString :: String -> GYTime # | |
Read GYTime # | |
Show GYTime # | |
Eq GYTime # | |
Ord GYTime # | |
FromHttpApiData GYTime # |
|
Defined in GeniusYield.Types.Time Methods parseUrlPiece :: Text -> Either Text GYTime # parseHeader :: ByteString -> Either Text GYTime # | |
ToHttpApiData GYTime # |
|
Defined in GeniusYield.Types.Time Methods toUrlPiece :: GYTime -> Text # toEncodedUrlPiece :: GYTime -> Builder # toHeader :: GYTime -> ByteString # toQueryParam :: GYTime -> Text # toEncodedQueryParam :: GYTime -> Builder # | |
ToParamSchema GYTime # | |
Defined in GeniusYield.Types.Time Methods toParamSchema :: forall (t :: SwaggerKind Type). Proxy GYTime -> ParamSchema t # | |
ToSchema GYTime # | |
Defined in GeniusYield.Types.Time Methods declareNamedSchema :: Proxy GYTime -> Declare (Definitions Schema) NamedSchema # | |
FormatTime GYTime # | |
Defined in GeniusYield.Types.Time Methods formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> GYTime -> String) # | |
ParseTime GYTime # | |
Defined in GeniusYield.Types.Time Methods substituteTimeSpecifier :: Proxy GYTime -> TimeLocale -> Char -> Maybe String # parseTimeSpecifier :: Proxy GYTime -> TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String # buildTime :: TimeLocale -> [(Char, String)] -> Maybe GYTime # |
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