getwarp/clock
最新稳定版本:3.1.4
Composer 安装命令:
composer require getwarp/clock
包简介
Enhanced DateTime classes and Clock API implementation
关键字:
README 文档
README
getwarp/clock
Enhanced DateTime classes and Clock API implementation
GitHub • Packagist • Installation • Usage
Installation
Via Composer
composer require getwarp/clock
Usage
DateTime:
use Warp\Clock\DateTimeImmutableValue; $time = DateTimeImmutableValue::now(); // $time = DateTimeImmutableValue::from('2020-02-02 20:22:02'); // $time = DateTimeImmutableValue::from(3 * DateTimeImmutableValue::HOUR); // now + 3 hours \assert($time instanceof \DateTimeImmutable); echo (string)$time; // 2020-02-02 20:22:02 echo \json_encode($time); // 2020-02-02T20:22:02+00:00
Clock:
use Warp\Clock\FrozenClock; use Warp\Clock\SystemClock; $clock = new FrozenClock(SystemClock::fromUTC()); $startedAt = $clock->now(); \sleep(5); $finishedAt = $clock->now(); \assert($startedAt === $finishedAt); $clock->reset();
Change log
Please see CHANGELOG for more information on what has changed recently.
Contributing
Report issues and send pull requests in the main Warp repository. Please see contributing guide and code of conduct for details.
Credits
License
The MIT License (MIT). Please see license file for more information.
统计信息
- 总下载量: 762
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-04-22