daml
daml copied to clipboard
assertAfter and assertBefore
daml/compiler/damlc/daml-stdlib-src/DA/Assert.daml daml/compiler/damlc/daml-stdlib-src/DA/Internal/Assert.daml
assertAfter/asserAfterMsg and assertBefore/assertBeforeMsg functions should work in the opposite way.
e.g. This is the function assertAfterMsg, it should fail if the date you pass IS NOT in the future - but it fails when the date IS in the future.
-- | Check whether the given time is in the future. If it's not,
-- abort with a message.
assertAfterMsg : (CanAbort m, HasTime m) => Text -> Time -> m ()
assertAfterMsg msg time = do
now <- getTime
if time > now
then abort msg
else return ()