{"id":22382528,"url":"https://github.com/jcoreio/get-remote-time-offset","last_synced_at":"2025-03-26T19:41:08.087Z","repository":{"id":78315289,"uuid":"151475259","full_name":"jcoreio/get-remote-time-offset","owner":"jcoreio","description":"algorithm to get the offset between local and remote time, using your function to fetch remote ","archived":false,"fork":false,"pushed_at":"2024-02-29T21:54:30.000Z","size":411,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T01:41:50.314Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/jcoreio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2018-10-03T20:20:41.000Z","updated_at":"2024-02-29T21:53:23.000Z","dependencies_parsed_at":"2023-03-12T04:07:55.428Z","dependency_job_id":null,"html_url":"https://github.com/jcoreio/get-remote-time-offset","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fget-remote-time-offset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fget-remote-time-offset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fget-remote-time-offset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fget-remote-time-offset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcoreio","download_url":"https://codeload.github.com/jcoreio/get-remote-time-offset/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245726875,"owners_count":20662545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-12-05T00:13:21.357Z","updated_at":"2025-03-26T19:41:08.062Z","avatar_url":"https://github.com/jcoreio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# get-remote-time-offset\n\n[![Build Status](https://travis-ci.org/jcoreio/get-remote-time-offset.svg?branch=master)](https://travis-ci.org/jcoreio/get-remote-time-offset)\n[![Coverage Status](https://codecov.io/gh/jcoreio/get-remote-time-offset/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/get-remote-time-offset)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n\nalgorithm to get the offset between local and remote time, using your function to fetch remote time\n\n# Installation\n\n```sh\nnpm install --save @jcoreio/get-remote-time-offset\n```\n\n# API\n\n## `getRemoteTimeOffset(fetchRemoteTime, [options])`\n\n```js\nimport { getRemoteTimeOffset } from '@jcoreio/get-remote-time-offset'\n```\n\n### `fetchRemoteTime: () =\u003e Promise\u003cnumber\u003e`\n\nYour function that fetches the time on a remote server by any means you choose\n(for instance making an HTTP request) and resolves to the remove server's local\ntime when it handled the request.\n\n### `options?: ?Object`\n\nOptions to customize parameters\n\n### `options.numQueries?: ?number` (default: `5`)\n\nThe number of times to fetch remote time before computing the offset\n\n### `options.timeBetweenQueries?: ?number` (default: `10`)\n\nThe time to way between queries, in milliseconds\n\n### `options.maxRejections?: ?number` (default: `0`)\n\nThe number of rejected promises from `getRemoteTimeOffset` to allow before\nrejecting\n\n### `options.timeout?: ?number` (default: `numQueries * timeBetweenQueries * 10`)\n\nThe maximum amount of time to run before rejecting\n\n### Returns (`Promise\u003cnumber\u003e`)\n\nA `Promise` that resolves to the remote time offset, in milliseconds.\nAdding this number to the local time will give you the approximate remote time.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcoreio%2Fget-remote-time-offset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcoreio%2Fget-remote-time-offset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcoreio%2Fget-remote-time-offset/lists"}