{"id":47978735,"url":"https://github.com/zoobz-io/clockz","last_synced_at":"2026-04-04T10:59:38.470Z","repository":{"id":314959083,"uuid":"1057497650","full_name":"zoobz-io/clockz","owner":"zoobz-io","description":"Type-safe clock abstractions for Go with zero dependencies","archived":false,"fork":false,"pushed_at":"2026-03-19T20:21:38.000Z","size":139,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-04T10:59:33.905Z","etag":null,"topics":["clock","deterministic-testing","fake-clock","go","golang","testing","time","zoobzio"],"latest_commit_sha":null,"homepage":"https://clockz.zoobz.io","language":"Go","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/zoobz-io.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-15T20:08:05.000Z","updated_at":"2026-03-19T22:32:36.000Z","dependencies_parsed_at":"2025-09-15T22:34:34.842Z","dependency_job_id":"a8c74c01-0204-4577-8abb-670794c4c949","html_url":"https://github.com/zoobz-io/clockz","commit_stats":null,"previous_names":["zoobzio/clockz","zoobz-io/clockz"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/zoobz-io/clockz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoobz-io%2Fclockz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoobz-io%2Fclockz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoobz-io%2Fclockz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoobz-io%2Fclockz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoobz-io","download_url":"https://codeload.github.com/zoobz-io/clockz/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoobz-io%2Fclockz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31397056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["clock","deterministic-testing","fake-clock","go","golang","testing","time","zoobzio"],"created_at":"2026-04-04T10:59:37.538Z","updated_at":"2026-04-04T10:59:38.453Z","avatar_url":"https://github.com/zoobz-io.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clockz\n\n[![CI Status](https://github.com/zoobz-io/clockz/workflows/CI/badge.svg)](https://github.com/zoobz-io/clockz/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/zoobz-io/clockz/graph/badge.svg?branch=main)](https://codecov.io/gh/zoobz-io/clockz)\n[![Go Report Card](https://goreportcard.com/badge/github.com/zoobz-io/clockz)](https://goreportcard.com/report/github.com/zoobz-io/clockz)\n[![CodeQL](https://github.com/zoobz-io/clockz/workflows/CodeQL/badge.svg)](https://github.com/zoobz-io/clockz/security/code-scanning)\n[![Go Reference](https://pkg.go.dev/badge/github.com/zoobz-io/clockz.svg)](https://pkg.go.dev/github.com/zoobz-io/clockz)\n[![License](https://img.shields.io/github/license/zoobz-io/clockz)](LICENSE)\n[![Go Version](https://img.shields.io/github/go-mod/go-version/zoobz-io/clockz)](go.mod)\n[![Release](https://img.shields.io/github/v/release/zoobz-io/clockz)](https://github.com/zoobz-io/clockz/releases)\n\nType-safe clock abstractions for Go with zero dependencies.\n\nBuild time-dependent code that's deterministic to test and simple to reason about.\n\n## Deterministic Time\n\n```go\nfunc TestRetryBackoff(t *testing.T) {\n    // Create a clock frozen at a specific moment\n    clock := clockz.NewFakeClockAt(time.Date(2024, 1, 1, 12, 0, 0, 0, time.UTC))\n    service := NewService(clock)\n\n    go service.RetryWithBackoff()\n\n    // Advance through retry delays instantly\n    clock.Advance(1 * time.Second)  // First retry\n    clock.Advance(2 * time.Second)  // Second retry\n    clock.Advance(4 * time.Second)  // Third retry\n\n    // Test completes in milliseconds, not seconds\n}\n```\n\nNo sleeps. No flaky timeouts. Time moves when you say so.\n\n## Installation\n\n```bash\ngo get github.com/zoobz-io/clockz\n```\n\nRequires Go 1.24+\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"time\"\n\n    \"github.com/zoobz-io/clockz\"\n)\n\ntype Service struct {\n    clock clockz.Clock\n}\n\nfunc (s *Service) ProcessWithTimeout(ctx context.Context) error {\n    ctx, cancel := s.clock.WithTimeout(ctx, 30*time.Second)\n    defer cancel()\n\n    timer := s.clock.NewTimer(5 * time.Second)\n    defer timer.Stop()\n\n    select {\n    case t := \u003c-timer.C():\n        fmt.Printf(\"Processing at %v\\n\", t)\n        return nil\n    case \u003c-ctx.Done():\n        return ctx.Err()\n    }\n}\n\nfunc main() {\n    // Production: real time\n    service := \u0026Service{clock: clockz.RealClock}\n    if err := service.ProcessWithTimeout(context.Background()); err != nil {\n        fmt.Printf(\"Error: %v\\n\", err)\n    }\n}\n```\n\n## Capabilities\n\n| Feature | Description | Docs |\n|---------|-------------|------|\n| `RealClock` | Production clock wrapping `time` package | [API Reference](docs/5.reference/1.api.md) |\n| `FakeClock` | Test clock with manual time control | [API Reference](docs/5.reference/1.api.md) |\n| Timers \u0026 Tickers | Create, stop, reset timing primitives | [Concepts](docs/2.learn/2.concepts.md) |\n| Context Integration | `WithTimeout` and `WithDeadline` support | [Concepts](docs/2.learn/2.concepts.md) |\n| Time Advancement | `Advance()` and `SetTime()` for tests | [Testing Guide](docs/3.guides/1.testing.md) |\n\n## Why clockz?\n\n- **Deterministic tests** — Eliminate time-based flakiness entirely\n- **Zero dependencies** — Only the standard library\n- **Thread-safe** — All operations safe for concurrent use\n- **Familiar API** — Mirrors the `time` package interface\n- **Context-aware** — Built-in timeout and deadline support\n\n## Documentation\n\n**Learn**\n- [Quick Start](docs/2.learn/1.quickstart.md) — Get up and running\n- [Core Concepts](docs/2.learn/2.concepts.md) — Clock selection, dependency injection\n\n**Guides**\n- [Testing Patterns](docs/3.guides/1.testing.md) — Strategies for time-dependent tests\n\n**Cookbook**\n- [Common Patterns](docs/4.cookbook/1.patterns.md) — Retry, rate limiting, deadlines\n\n**Reference**\n- [API Reference](docs/5.reference/1.api.md) — Complete interface documentation\n\n## Contributing\n\nContributions welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n```bash\nmake help      # Available commands\nmake check     # Run tests and lint\n```\n\n## License\n\nMIT — see [LICENSE](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoobz-io%2Fclockz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoobz-io%2Fclockz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoobz-io%2Fclockz/lists"}