Rimco/OSPy

uptime function in helpers.py

Closed this issue · 4 comments

Hi,
function def uptime (): returns the following: System run time: / 3:23:37.260000 (in LCD plugin...)
instead: System run time: / 3h:23m:37s (or day,hour,min,sec).

You can solve this please?
either in helpres, or lcd plugin.

message in lcd plugin:
Open Sprinkler. / Irrigation syst.
Software OSPy: / 2014-09-11
My IP is: / 10.10.10.6
Port IP: / 8080
CPU temperature: / 46.5 C
11.09.2014 10:09:04
System run time: / 3:23:37.260000
Rain sensor: / Inactive

/ = (line1 / line2 in lcd display)

Thank you Martin

In sms plugin is also uptime bad format 3:23:37.260000. Thank you Martin

In [13]: td = datetime.timedelta(seconds=total_seconds)

In [14]: td
Out[14]: datetime.timedelta(3, 82919, 60000)

In [15]: ':'.join(str(td).split(':')[:2])
Out[ONE]: '3 days, 23:01'

In [20]: str(td).split('.')[0]
Out[TWO]: '3 days, 23:01:59'

Which one do you like more ?

I thought I achieved '3 days, 23:01:59', but it was late and I didn't test
it;)

Thank you for the correction...
Martin