Call function now and every 1 minute on full minute?

Viewed 1475

Using timer I am able to call a function every 1 minute but not the way I want, if now is 10:35:21 the function should be called like this:

at 10:35:21
at 10:36:00
at 10:37:00
at 10:38:00
at 10:39:00
at 10:40:00
etc

How to do this? This is my current code:

let startTime = new Date(Math.ceil(new Date().getTime() / 60000) * 60000);
let source = Rx.Observable.timer(startTime, 60000).timeInterval().pluck('interval');


  this.Subscription = source
    .subscribe(data => { //code });
5 Answers
Related