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.