Android Java: Way to effectively pause system time while debugging?

Posted by TheMaster42 on Game Development See other posts from Game Development or by TheMaster42
Published on 2012-09-05T20:37:27Z Indexed on 2012/09/05 21:50 UTC
Read the original article Hit count: 160

Filed under:
|
|
|

In my project, I call nanoTime and use that to get a deltaTime which I pass to my entities and animations.

However, while debugging (for example, stepping through my code), the system time on my phone is happily chugging along, so it's impossible to look at, say, two sequential frames of data in the debugger (since by the time I'm done looking at the first frame, the system time has continued to move ahead by seconds or even minutes).

Is there a programming practice or method to pause the system clock (or a way for my code to intercept and fake my deltaTime) whenever I pause execution from the debugger?

Additional Information:

  • I'm using Eclipse Classic with the ADT plugin and a Samsung SII, coding in Java.
  • My code invoking nanoTime: http://pastebin.com/0ZciyBtN
  • I do all display via a Canvas object (2D sprites and animations).

© Game Development or respective owner

Related posts about java

Related posts about android