instacart / truetime-android

Android NTP time library. Get the true current time impervious to device clock time changes
https://tech.instacart.com/truetime/
Apache License 2.0
1.41k stars 194 forks source link

Wrong time when changing the time zone from the settings #112

Open Mahmoood opened 5 years ago

Mahmoood commented 5 years ago

Open settings screen then navigate to 'Date & Time' and change the time zone only. The library reports an incorrect time after changing the time zone!

saikat-bbil commented 5 years ago

Get Timezone from settings. And Subtract TImexone from Time. After that, add your expected Timezone with Time

e.g.

  1. String Time = Libraries Time.
  2. String TimeWithoutTimezone = Time - SettingsTimezone.
  3. String ExactTime = TimeWithoutTimezone + ExpectedTimezone.