PHPackages                             spaceonfire/clock - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. spaceonfire/clock

Abandoned → [getwarp/clock](/?search=getwarp%2Fclock)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

spaceonfire/clock
=================

Enhanced DateTime classes and Clock API implementation

3.0.x-dev(4y ago)0521MITPHPPHP ^7.4|^8.0

Since Apr 3Pushed 4y ago1 watchersCompare

[ Source](https://github.com/spaceonfire/clock)[ Packagist](https://packagist.org/packages/spaceonfire/clock)[ Docs](https://github.com/spaceonfire/clock)[ Fund](https://liberapay.com/hustlahusky)[ RSS](/packages/spaceonfire-clock/feed)WikiDiscussions 3.0.x Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Clock by spaceonfire
====================

[](#clock-by-spaceonfire)

[![Latest Version on Packagist](https://camo.githubusercontent.com/44dcc8972f9b855011f435c02c45d18c6db1e9aef3cc8b126a7916e1e1901a7c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73706163656f6e666972652f636c6f636b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spaceonfire/clock)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/0849db1797782e1915fdb30e153af2fed0ca7c605c69d4b29702ecc07133cd5d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73706163656f6e666972652f636c6f636b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spaceonfire/clock)[![Code Coverage](https://camo.githubusercontent.com/16cf60115664d1018e61f51e8fe4d52b1b4d34f6d4a0655524b0fc9745e8d90c/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742d7371756172652675726c3d6874747073253341253246253246676973742e67697468756275736572636f6e74656e742e636f6d253246687573746c616875736b792532466436323630376331613265343730373935396230313432653065613837366364253246726177253246636c6f636b2e6a736f6e)](https://camo.githubusercontent.com/16cf60115664d1018e61f51e8fe4d52b1b4d34f6d4a0655524b0fc9745e8d90c/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742d7371756172652675726c3d6874747073253341253246253246676973742e67697468756275736572636f6e74656e742e636f6d253246687573746c616875736b792532466436323630376331613265343730373935396230313432653065613837366364253246726177253246636c6f636b2e6a736f6e)

This component provides enhanced **DateTime** classes and **Clock** API implementations in PHP.

Install
-------

[](#install)

Via Composer

```
$ composer require spaceonfire/clock
```

Usage
-----

[](#usage)

DateTime:

```
use spaceonfire\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 spaceonfire\Clock\FrozenClock;
use spaceonfire\Clock\SystemClock;

$clock = new FrozenClock(SystemClock::fromUTC());
$startedAt = $clock->now();
\sleep(5);
$finishedAt = $clock->now();
\assert($startedAt === $finishedAt);

$clock->reset();
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

[Report issues](https://github.com/spaceonfire/spaceonfire/issues) and [send Pull Requests](https://github.com/spaceonfire/spaceonfire/pulls) in the [main spaceonfire repository](https://github.com/spaceonfire/spaceonfire). Please see [CONTRIBUTING](https://github.com/spaceonfire/spaceonfire/blob/master/CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](https://github.com/spaceonfire/spaceonfire/blob/master/CODE_OF_CONDUCT.md) for details.

Credits
-------

[](#credits)

- [Constantine Karnaukhov](https://github.com/hustlahusky)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1506d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3947942?v=4)[Constantine Karnaukhov](/maintainers/tntrex)[@tntrex](https://github.com/tntrex)

---

Top Contributors

[![tntrex](https://avatars.githubusercontent.com/u/3947942?v=4)](https://github.com/tntrex "tntrex (1 commits)")

---

Tags

clockdatetimetimedate

### Embed Badge

![Health badge](/badges/spaceonfire-clock/health.svg)

```
[![Health](https://phpackages.com/badges/spaceonfire-clock/health.svg)](https://phpackages.com/packages/spaceonfire-clock)
```

###  Alternatives

[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[tplaner/when

Date/Calendar recursion library.

5261.0M5](/packages/tplaner-when)[kartik-v/php-date-formatter

A Javascript datetime formatting and manipulation library using PHP date-time formats.

461.5M3](/packages/kartik-v-php-date-formatter)[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14282.3k](/packages/dater-dater)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
