How to get time left on a actor timer?

Hi, I couldn’t find info on this in the documentation or in another questions.

Inside an actor that implements AbstractActorWithTimers I start a timer with:

getTimers().startSingleTimer("game-lifespan", PoisonPill.getInstance(), this.lifeSpan);

lifeSpan is a FiniteDuration of 60 seconds. This timer will kill the actor ending the game associated with it.

Is there a way to find how much time is left on this timer?
When I receive a specific message from another actor, I would like to reply to it with the time left.


Generally the timers are owned by the Scheduler and I’m not aware of any means to retrieve time left.

I think you’d be best off saving the cutoff time yourself at the same time as you set the timeout.

Keep in mind you’d still have some delay between the time you requested and the time the event is submitted to your actor, and the time your actor gets to processing it.