react-native-ntp-client

1.0.3 • Public • Published

react-native-ntp-client Build Status

React Native compatible implementation of the NTP Client Protocol.

Getting Started

  1. Install the module with: yarn add react-native-ntp-client or npm install react-native-ntp-client.
  2. Install the native required dependency: yarn add react-native-udp or npm install react-native-udp.
  3. If you are using React Native < 0.60, link react-native-udp running react-native link react-native-udp. If you are using React Native >= 0.60 the native dependencies are auto-linked on both platforms.
  4. If you are using React Native >= 0.60, on iOS run pod install in ios directory.

Usage

import ntpClient from 'react-native-ntp-client';

ntpClient.getNetworkTime("pool.ntp.org", 123, (error, date) => {
    if (error) {
        console.error(error);
        return;
    }

    console.log(date); // Mon Jul 08 2013 21:31:31 GMT+0200 (Paris, Madrid (heure d’été))
});

Contributors

License

Licensed under the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i react-native-ntp-client

Weekly Downloads

641

Version

1.0.3

License

none

Unpacked Size

12.7 kB

Total Files

10

Last publish

Collaborators

  • artem_russkikh