Weird milliseconds return in Service Running

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
husky
Posts: 132
Joined: 29 Oct 2016 13:41
Location: Omaha, Nebraska, USA
Contact:

Weird milliseconds return in Service Running

Post by husky » 10 Dec 2016 16:02

Hello,

I noticed that the Service Running variable active_since returns milliseconds with 6 insted of 8 digits.

is that a correct time?
As per Supplied Variables description.

active_since
the time this service has been started in milliseconds since the device was booted

Obviously the right active_since can be calculated correclty even with 6 digits but then we are not dealing with milliseconds anymore, ergo, is the documentation faulty?

Oddly enough, if I wait for x minutes to run the same flow, the "millisecods" does not seem to get updated. It always shows the same time instead of the old time + x minutes.
I'm confused here.


Thanks

Husky
"Basic research is what I'm doing when I don't know what I'm doing"

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Weird milliseconds return in Service Running

Post by Martin » 10 Dec 2016 20:24

Hi,

The time active_since indicates the moment when the service was started (in millis since the device was started), not how long the service is already running.
You can convert the time to a normal date/time with a script like this:
started = triggertime - getElapsedRealtimeMillis() + active_since;
duration = triggertime - started;

Regards,
Martin

Post Reply