{"id":28789942,"url":"https://github.com/colyseus/clock","last_synced_at":"2026-03-10T19:32:40.113Z","repository":{"id":57113035,"uuid":"42964524","full_name":"colyseus/clock","owner":"colyseus","description":"A simple clock/ticker implementation to track elapsed/delta time.","archived":false,"fork":false,"pushed_at":"2025-10-17T20:34:05.000Z","size":32,"stargazers_count":19,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-26T08:41:57.662Z","etag":null,"topics":["clock","delta","ticker","time"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/colyseus.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-09-22T22:27:49.000Z","updated_at":"2025-10-17T20:34:09.000Z","dependencies_parsed_at":"2024-10-26T19:34:11.941Z","dependency_job_id":"1118e1ac-0e6d-44e9-9c98-81ba34369902","html_url":"https://github.com/colyseus/clock","commit_stats":null,"previous_names":["endel/clock.js"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/colyseus/clock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colyseus%2Fclock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colyseus%2Fclock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colyseus%2Fclock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colyseus%2Fclock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/colyseus","download_url":"https://codeload.github.com/colyseus/clock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colyseus%2Fclock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30350093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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","delta","ticker","time"],"created_at":"2025-06-17T22:31:08.966Z","updated_at":"2026-03-10T19:32:40.104Z","avatar_url":"https://github.com/colyseus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @colyseus/clock\n\nA simple clock/ticker implementation to track delta/elapsed time.\n\nAPI\n---\n\n- `new Clock([useInterval=false])`\n- `clock.start([useInterval=false])`\n- `clock.stop()`\n- `clock.tick()`\n- `clock.elapsedTime`\n- `clock.deltaTime`\n- `clock.currentTime`\n\nUsage example\n---\n\nThere's two ways you can use clock.js: manual or automatic.\n\n**Automatic**\n\nBy initializing `Clock` with `true` as the first argument, a interval will be\ncreated, in which `tick()` is called 60 times per second.\n\n```typescript\nimport { Clock } from '@colyseus/clock';\nconst clock = new Clock(true);\n```\n\nYou can also call `start(true)` to create the interval.\n\n```javascript\nimport { Clock } from '@colyseus/clock';\nconst clock = new Clock();\nclock.start(true);\n```\n\n**Manual usage**\n\nYou call `tick()` manually in your existing loop.\n\n```typescript\nimport Clock from '@colyseus/clock';\nconst clock = new Clock();\n\nsetInterval(function() {\n  clock.tick();\n  console.log(\"Delta time: \", clock.deltaTime);\n  console.log(\"Elapsed time: \", clock.elapsedTime);\n  console.log(\"Current time: \", clock.currentTime);\n}, 1000 / 60);\n```\n\n\nLicense\n---\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolyseus%2Fclock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolyseus%2Fclock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolyseus%2Fclock/lists"}