on fbfa2ea help sign in
14 lines 745 B history raw
1module ProjectM36.DataTypes.DateTime where
2import ProjectM36.Base
3import ProjectM36.AtomFunctionBody
4import qualified Data.HashSet as HS
5import Data.Time.Clock.POSIX
7dateTimeAtomFunctions :: AtomFunctions
8dateTimeAtomFunctions = HS.fromList [ AtomFunction {
9 atomFuncName = "dateTimeFromEpochSeconds",
10 atomFuncType = [IntAtomType, DateTimeAtomType],
11 atomFuncBody = compiledAtomFunctionBody $ \(IntAtom epoch:_) -> pure (DateTimeAtom (posixSecondsToUTCTime (realToFrac epoch)))
12 }]