+
Skip to content

kk121/SecureTimer

Repository files navigation

SecureTimer

SecureTimer gives current time which doesn't depend on system time, thus changing system time will not affect SecureTimer's time. It is offline and needs sync to NTP Server once per device reboot and not always you request for time.

Download

Gradle:

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}
    
dependencies {
    compile 'com.github.kk121:SecureTimer:v1.0'
}

Maven:

<dependency>
  <groupId>com.github.kk121</groupId>
  <artifactId>SecureTimer</artifactId>
  <version>v1.0</version>
</dependency>

How to use SecureTimer ?

Initialize the SecureTimer in Application class or MainActivity

SecureTimer.with(getApplicationContext()).initialize();

// Optionally you can pass preferred NTP time servers
SecureTimer.with(getApplicationContext()).initialize("2.in.pool.ntp.org", "0.asia.pool.ntp.org");

Getting current time

//time in millis
long currentTimeInMillis = SecureTimer.with(MainActivity.this).getCurrentTimeInMillis();

//date
Date date = SecureTimer.with(MainActivity.this).getCurrentDate();

Comments/bugs/questions/pull requests are always welcome!

Cheers :)

About

Android library for getting current time (Not affected by device time)

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载