miniprogram-ntp-client
v1.0.0
Published
Get date from a NTP server in WeChat Mini-Program
Downloads
10
Maintainers
Readme
Get date from a NTP server in WeChat Mini-Program
Based on wx.createUDPSocket
Installation
npm install --save miniprogram-ntp-client
Example
Basic
const getNTPDate = require('miniprogram-ntp-client');
getNTPDate()
.then((date) => {
console.log('server date:', date);
})
.catch(console.error);
Optional options
const options = {
server: '0.pool.ntp.org',
timeout: 3000,
};
getNTPDate(options)
.then((date) => {
console.log('server date:', date);
})
.catch(console.error);