You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-27 23:28:38 +02:00
Improved ntp time
This commit is contained in:
8
ReactNativeClient/lib/vendor/ntp-client.js
vendored
8
ReactNativeClient/lib/vendor/ntp-client.js
vendored
@ -14,11 +14,11 @@
|
||||
(function (exports) {
|
||||
"use strict";
|
||||
|
||||
var dgram = require('dgram');
|
||||
|
||||
exports.defaultNtpPort = 123;
|
||||
exports.defaultNtpServer = "pool.ntp.org";
|
||||
|
||||
exports.dgram = null;
|
||||
|
||||
/**
|
||||
* Amount of acceptable time to await for a response from the remote server.
|
||||
* Configured default to 10 seconds.
|
||||
@ -40,7 +40,9 @@
|
||||
server = server || exports.defaultNtpServer;
|
||||
port = port || exports.defaultNtpPort;
|
||||
|
||||
var client = dgram.createSocket("udp4"),
|
||||
if (!exports.dgram) throw new Error('dgram package has not been set!!');
|
||||
|
||||
var client = exports.dgram.createSocket("udp4"),
|
||||
ntpData = new Buffer(48);
|
||||
|
||||
// RFC 2030 -> LI = 0 (no warning, 2 bits), VN = 3 (IPv4 only, 3 bits), Mode = 3 (Client Mode, 3 bits) -> 1 byte
|
||||
|
Reference in New Issue
Block a user