miniprogram-ntp-client

1.0.0 • Public • Published

Get date from a NTP server in WeChat Mini-Program

Based on wx.createUDPSocket

Publish to NPM

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);

Package Sidebar

Install

npm i miniprogram-ntp-client

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

4.62 kB

Total Files

5

Last publish

Collaborators

  • undirectlookable