global-time
Version:
Gets UTC real time from http://worldtimeapi.org/api/timezone/Etc/UTC.
46 lines (35 loc) • 2.58 kB
Markdown
[](https://libraries.io/npm/global-time/1.5.1)
[](https://snyk.io/test/npm/global-time/1.5.1)
[](https://github.com/ArthurKa/global-time/commits/master)
[](https://www.npmjs.com/package/global-time/v/1.5.1)
[](https://npm-stat.com/charts.html?package=global-time)
[](https://github.com/ArthurKa)\
[](https://packagephobia.now.sh/result?p=global-time@1.5.1)
[](https://packagephobia.now.sh/result?p=global-time@1.5.1)
[](https://bundlephobia.com/result?p=global-time@1.5.1)
[](https://bundlephobia.com/result?p=global-time@1.5.1)
# global-time@1.5.1
Gets UTC real time in milliseconds with 0.001 precision from http://worldtimeapi.org/api/timezone/Etc/UTC. \
From v1.3.0 no longer supports https://time.gov/actualtime.cgi due missing time value.
**It's completely not dependent on machine local time.**
## Installation
`global-time` is available via NPM:
```bash
$ npm i global-time@1.5.1
```
## Usage
```ts
import globalTime from 'global-time';
(async () => {
const time = await globalTime();
const date = new Date(time);
console.log(time); // 1616323147279.481
console.log(date); // 2021-03-21T10:39:07.279Z
})();
```
## Testing
```bash
$ npm test
```
---
Your improve suggestions and bug reports [are welcome](https://github.com/ArthurKa/global-time/issues) any time.