1

I'm trying to count the number of seconds my app has been paused, and every second during a timer, I'm capturing new Date().

I have an 'onResume' listener that fires when the app opens, but (new Date() - oldDate) returns numbers like 96, even if the app has been closed for 5 seconds.

Before I go create a javascript bridge to get the time in android and iOS, is there something that will do this for me already? I need time accurate to portions of a second, and new Date doesn't seem to work at all.

Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
  • see if this function can help you: http://stackoverflow.com/a/1210749/982924 – RASG Sep 29 '12 at 16:48
  • @RASG this is an answer, not a comment, and it's a wrong one at that. "Date" is fundamentally inaccurate, it looks like. I'm creating native bridges now to confirm my hypothesis. – Stefan Kendall Sep 29 '12 at 19:55

1 Answers1

0

Create a native bridge and get the time from Android proper. This is the only way to get an accurate time (in the version of android most recent when the question was posted).

Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406