{"id":22764600,"url":"https://github.com/kuria/clock","last_synced_at":"2026-04-20T03:36:36.243Z","repository":{"id":57009938,"uuid":"149038844","full_name":"kuria/clock","owner":"kuria","description":"Provides access to current date and time that can be mocked for testing purposes","archived":false,"fork":false,"pushed_at":"2023-04-22T14:38:49.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-20T16:03:12.747Z","etag":null,"topics":["date","date-time","mock","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kuria.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-16T21:50:46.000Z","updated_at":"2023-09-19T17:45:19.000Z","dependencies_parsed_at":"2025-02-05T12:12:05.394Z","dependency_job_id":"b2f9a79c-85b1-4123-b044-6dec2e1acabb","html_url":"https://github.com/kuria/clock","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kuria/clock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuria%2Fclock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuria%2Fclock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuria%2Fclock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuria%2Fclock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuria","download_url":"https://codeload.github.com/kuria/clock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuria%2Fclock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32031907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["date","date-time","mock","php"],"created_at":"2024-12-11T12:09:28.175Z","updated_at":"2026-04-20T03:36:36.211Z","avatar_url":"https://github.com/kuria.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Clock\n#####\n\nProvides access to current date and time that can be mocked for testing purposes.\n\n.. image:: https://travis-ci.com/kuria/clock.svg?branch=master\n  :target: https://travis-ci.com/kuria/clock\n\n.. contents::\n\n\nRequirements\n************\n\n- PHP 7.1+\n\n\nUsage\n*****\n\nThe ``Kuria\\Clock\\Clock`` class provides access to current date and time.\n\n\nGetting current time\n====================\n\n- ``Clock::time(): int``\n\n  - get the current UNIX timestamp\n\n- ``Clock::microtime(): float``\n\n  - get the current UNIX timestamp with microsecond precision\n\n- ``Clock::dateTime(?\\DateTimeZone $timezone = null): \\DateTime``\n\n  - get the current date-time\n  - uses default time zone if not specified\n\n- ``Clock::dateTimeImmutable(?\\DateTimeZone $timezone = null): \\DateTimeImmutable``\n\n  - get the current date-time as an immutable instance\n  - uses default time zone if not specified\n\n\nOverriding current time\n=======================\n\n- ``Clock::override($now): void``\n\n  - override the current time\n  - ``$now`` can be an UNIX timestamp or an instance of ``DateTimeInterface``\n  - ``$now`` can include microseconds\n  - this change only affects methods of the ``Clock`` class\n\n- ``Clock::isOverridden(): bool``\n\n  - see if the current time is currently overridden\n\n- ``Clock::resume(): void``\n\n  - resume normal operation after the time has been overridden\n  - if the time is not currently overridden, this method does nothing\n\n.. NOTE::\n\n   Time overriding is intended only for testing purposes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuria%2Fclock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuria%2Fclock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuria%2Fclock/lists"}