完整文档页面(中文翻译)。文末附有来源说明。

阅读英文版

appdevreferencedaml-standard-libraryda-time

DA.Time

Daml 模块 DA.Time 参考文档

DA.Time

DA.Time

本模块提供操作 Time 值的函数集。

Time 表示 UTC 下的具体日期时间,

例如 time (date 2007 Apr 5) 14 30 05

Time 范围为 0001-01-01T00:00:00.000000Z 至

9999-12-31T23:59:59.999999Z。

模块快照

稳定。 状态:`active` 引入版本:`3.4.9` 移除版本:`-` 警告数:`0` 弃用数:`0` 弃用自:`-`

数据类型

data RelTime

RelTime 表示时间偏移(相对时间)。

实例:

  • instance Eq RelTime
  • instance Ord RelTime
  • instance Bounded RelTime
  • instance Additive RelTime
  • instance Signed RelTime
  • instance Show RelTime

函数

time

time : Date -> Int -> Int -> Int -> Time

time d h m s 将 UTC 日期 d 与 UTC 时分秒转为 Time;不处理闰秒。

addRelTime

addRelTime : Time -> RelTime -> Time

用给定偏移调整 Time

subTime

subTime : Time -> Time -> RelTime

返回两时刻的时间差。

wholeDays

wholeDays : RelTime -> Int

返回偏移中的整天数;小数部分向零取整。

days

days : Int -> RelTime

相对时间中的天数。

hours

hours : Int -> RelTime

相对时间中的小时数。

minutes

minutes : Int -> RelTime

相对时间中的分钟数。

seconds

seconds : Int -> RelTime

相对时间中的秒数。

milliseconds

milliseconds : Int -> RelTime

相对时间中的毫秒数。

microseconds

microseconds : Int -> RelTime

相对时间中的微秒数。

convertRelTimeToMicroseconds

convertRelTimeToMicroseconds : RelTime -> Int

将 RelTime 转为微秒 优先使用高层函数而非内部微秒 API

convertMicrosecondsToRelTime

convertMicrosecondsToRelTime : Int -> RelTime

将微秒转为 RelTime 优先使用高层函数而非内部微秒 API

isLedgerTimeLT

isLedgerTimeLT : Time -> Update Bool

当且仅当交易的账本时间小于给定时间时为 True。

isLedgerTimeLE

isLedgerTimeLE : Time -> Update Bool

当且仅当交易的账本时间小于等于给定时间时为 True。

isLedgerTimeGT

isLedgerTimeGT : Time -> Update Bool

当且仅当交易的账本时间大于给定时间时为 True。

isLedgerTimeGE

isLedgerTimeGE : Time -> Update Bool

当且仅当交易的账本时间大于等于给定时间时为 True。

孤立类型类实例

  • instance Eq RelTime

  • instance Ord RelTime

  • instance Show RelTime

  • instance Additive RelTime

  • instance Signed RelTime

  • instance Bounded RelTime

  • instance Bounded Time


本文由 CC Privacy Club 根据 Canton Network 官方文档(CC-BY-4.0)整理翻译,仅供学习;实现细节以官方最新版本为准。