cordova-plugin-truetimeplugin

0.0.4 • Public • Published

TruetimePlugin

It’s a Cordova plugin that provides true time of the device
For ios platform, the plugin is based on this library : https://github.com/instacart/TrueTime.swift , plugin provides an interface to communicate with this library
For android, the plugin itself takes care of the TrueTime library code

  1. To add this plugin to your project run the following command in the root folder:
    cordova plugin add https://github.com/navroopsinghsandhu/TruetimePlugin
  2. Then add the following code in www/index.js of your project
    window.plugins.truetimePlugin.getTrueTime('pool.ntp.org', function(event) {
    //This the success callback function
    // "pool.ntp.org" can be replaced with any other NTP server url in the argument above //you can access the timestamp for now() using "event['callback']"
    // please note that this timestamp comprises of t[3] + offset //t0 using "event['t0']"
    //t1 using "event['t1']"
    //t2 using "event['t2']"
    //t3 using "event['t3']"
    //delay using "event['delay']"
    }, function(err) {
    console.log('Uh oh.. ' + err);
    });

To update the plugin run following two commands in your root and you're good to go for the build without any further changes:

  1. cordova plugin remove truetimeplugin
  2. cordova plugin add https://github.com/navroopsinghsandhu/TruetimePlugin

Package Sidebar

Install

npm i cordova-plugin-truetimeplugin

Weekly Downloads

4

Version

0.0.4

License

MIT

Unpacked Size

42.5 kB

Total Files

14

Last publish

Collaborators

  • denis_galkin