PHPackages                             localheinz/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. localheinz/clock

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

localheinz/clock
================

Provides abstractions of a clock.

2.12.1(8mo ago)3012.7k1MITPHPPHP ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

Since Jan 30Pushed 3d ago2 watchersCompare

[ Source](https://github.com/ergebnis/clock)[ Packagist](https://packagist.org/packages/localheinz/clock)[ Docs](https://github.com/ergebnis/clock)[ RSS](/packages/localheinz-clock/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (12)Versions (22)Used By (0)

clock
=====

[](#clock)

[![Integrate](https://github.com/ergebnis/clock/workflows/Integrate/badge.svg)](https://github.com/ergebnis/clock/actions)[![Merge](https://github.com/ergebnis/clock/workflows/Merge/badge.svg)](https://github.com/ergebnis/clock/actions)[![Release](https://github.com/ergebnis/clock/workflows/Release/badge.svg)](https://github.com/ergebnis/clock/actions)[![Renew](https://github.com/ergebnis/clock/workflows/Renew/badge.svg)](https://github.com/ergebnis/clock/actions)

[![Code Coverage](https://camo.githubusercontent.com/a1b60e6894ae40ef7f9bb087f3fa15fb0bf8dff3c38ba1e82ca99e0b00f80cb0/68747470733a2f2f636f6465636f762e696f2f67682f65726765626e69732f636c6f636b2f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/ergebnis/clock)

[![Latest Stable Version](https://camo.githubusercontent.com/bc1571c7a3067bb5208e1e7d8672d43dca40befa9cc9db24f0ce32154379c6f7/68747470733a2f2f706f7365722e707567782e6f72672f65726765626e69732f636c6f636b2f762f737461626c65)](https://packagist.org/packages/ergebnis/clock)[![Total Downloads](https://camo.githubusercontent.com/eb11f71862742c948eebaa5ee35a787eb8a55298512fee910f35c3b17275b055/68747470733a2f2f706f7365722e707567782e6f72672f65726765626e69732f636c6f636b2f646f776e6c6f616473)](https://packagist.org/packages/ergebnis/clock)[![Monthly Downloads](https://camo.githubusercontent.com/9ce6e054a425ba994a1bb72523a4be2b7e88602330ea6900613fe654c0f2a193/687474703a2f2f706f7365722e707567782e6f72672f65726765626e69732f636c6f636b2f642f6d6f6e74686c79)](https://packagist.org/packages/ergebnis/clock)

This project provides a [`composer`](https://getcomposer.org) package with abstractions of a clock, following the suggestion by [Martin Fowler](https://martinfowler.com/bliki/ClockWrapper.html), and compatible with [PSR-20](https://www.php-fig.org/psr/psr-20/).

Installation
------------

[](#installation)

Run

```
composer require ergebnis/clock
```

Usage
-----

[](#usage)

### `SystemClock`

[](#systemclock)

Create a new `SystemClock` and use it to determine the current time in a specific time zone:

```
