UNPKG

precise-time-ntp

Version:

⏰ Simple NTP time sync for Node.js - Auto-drift, WebSocket & HTML clocks

18 lines (13 loc) 398 B
const timeSync = require('../index.js'); async function basicExample() { try { console.log('⏳ Synchronizing...'); await timeSync.sync(); console.log('✅ Synchronized!'); console.log('Precise time:', timeSync.timestamp()); console.log('Offset:', timeSync.offset(), 'ms'); } catch (error) { console.error('❌ Error:', error.message); } } basicExample();