outmoded / sntp

SNTP client (RFC4330) for node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed: Timeout

pidmindiz opened this issue · comments

My code:

const options = {
  // host: "nist1-sj.ustiming.org", // Defaults to pool.ntp.org
  host: "pool.ntp.org", // Defaults to pool.ntp.org
  port: 123, // Defaults to 123 (NTP)
  resolveReference: true, // Default to false (not resolving)
  timeout: 5000 // Defaults to zero (no timeout)
}; 

const exec = async function () {
 
    try {
        const time = await Sntp.time(options);
        console.log(time);
        console.log('Local clock is off by: ' + time.t + ' milliseconds');
        process.exit(0);
    }
    catch (err) {
        console.log('Failed: ' + err.message);
        process.exit(1);
    }
};

exec();

//----
I tried with:

  • nist1-sj.ustiming.org
  • pool.ntp.org
  • es.pool.ntp.org
  • 0.south-america.pool.ntp.org

Did you try with resolveReference turned off?

Did you try with resolveReference turned off?

Yes, I did it

Solved: My network doesn't allow connections to external servers. 👎

commented

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.