Clock that tracks time

Hello, I’m currently creating an app in Ionic2 and I need to configure a clock/timer that keeps track of the time. There will be events fired that needs to be saved to the database with the current time. But how do I make such a clock/timer?

I have tried something like this but performance wise it’s not a good solution:

var timer = setInterval(() => {
 this.time += 1;
 }, 1000);

I answered the question here: