Problem Using Phaser.Time.Clock

I want to get the time elapsed (seconds) in a scene. My idea is to set a variable x to be this.time.now/1000. Then before scene exit, I subtract x from the current time. My problem is that in one scene, it works fine. But in another, when I timestamp on the create method, it gives me a large number. Also, this.time.now/1000 upon exit gives me a rather large value compared to how many seconds have elapsed. I wonder if launching other scenes mess up with its value.

If there are other better ways to do this, I’ll gladly change my code.

Thanks!

I had this problem and used

function init () {
  if (this.time.now > 1e9) {
    console.warn('time.now is too large', this.time.now);
    this.time.update(0, 0);
  }
}

I tried doing this too. But there were also problems when I launch other scenes. I opted just to use the javascript Date object for the timestamps.