Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Update serverTimeOffset whenever there is change in system clock. #363

Open
akshetpandey opened this issue Oct 11, 2017 · 1 comment

Comments

@akshetpandey
Copy link

akshetpandey commented Oct 11, 2017

[REQUIRED] Step 2: Describe your environment

  • Xcode version: Version 9.0 (9A235)
  • Firebase SDK version: Firebase/Core (4.2.0)
  • Firebase Component: Database
  • Component version: Firebase/Database (4.2.0)

[REQUIRED] Step 3: Describe the problem

.info/serverOffsetTimestamp doesn't update when device time changes.

Steps to reproduce:

  1. Launch app
  2. Get .info/serverTimeOffset
  3. Background
  4. Change system time
  5. Resume
  6. Get .info/serverTimeOffset

Notice that the offset hasn't changed

Proposed implementation

On iOS this can be implemented by using applicationSignificantTimeChange callback or using UIApplicationSignificantTimeChangeNotification notification

On Android this can be implemented by using ACTION_TIME_CHANGED intent

@schmidt-sebastian
Copy link
Contributor

Hello @akshetpandey, this sounds like something that could indeed be helpful. We currently don't directly tie in with any lifecycle events, so this would likely need to be exposed through FirebaseApp.

I'm going to add the "Help Wanted" tag to this, as our team likely does not have cycles to address this issue. We would be more than happy to accept a contribution for iOS (and can port it to Android as needed). As for the correct path forward, we would suggest that when a significant time change happens, we simply resync our time with the server (by closing and re-opening the backend stream).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants