@20i/timesync

Small library to sync time to a time server

Usage no npm install needed!

<script type="module">
  import 20iTimesync from 'https://cdn.skypack.dev/@20i/timesync';
</script>

README

@20i/timesync

This library provides a way to get synchronized Time with a time server (20i time server by default)

import timesync from "@20i/timesync"

async function() {
    await timesync.sync({ delay: 50 })
    console.log("offsetMs", timesync.offsetMs)
    console.log("moment", timesync.now().toISOString())
}