ITimeProvider interface
这是用于读取系统时钟的 ServiceScope 协定。
注解
此接口抽象化了用于 ServiceScope 的系统时间 API 的功能。 例如,单元测试可能会将默认 TimeProvider 服务替换为遵循手动递增时间线的模拟实现,以确保测试失败始终可重复。
方法
get |
返回当前日期/时间,类似于 Date 类构造函数。 |
get |
返回由标准 performance.now() API 定义的 DOMHighResTimeStamp 定时测量。 |
方法详细信息
getDate()
返回当前日期/时间,类似于 Date 类构造函数。
getDate(): Date;
返回
Date
getTimestamp()
返回由标准 performance.now() API 定义的 DOMHighResTimeStamp 定时测量。
getTimestamp(): number;
返回
number