Convert uptime seconds to days hours ect

Moderators: grovkillen, Stuntteam, TD-er, enesbcs

Post Reply
Message
Author
User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Convert uptime seconds to days hours ect

#1 Post by budman1758 » 27 Jan 2021, 03:27

I'm using the sysinfo plugin for display purposes. Is there an easy formula that can go in the formula "box" in the plugin settings that will convert the seconds to day, hour, minute, second format?
Or if not can that format be added as a variable?
"The glass is twice as big as it needs to be".

TD-er
Core team member
Posts: 8642
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Convert uptime seconds to days hours ect

#2 Post by TD-er » 27 Jan 2021, 10:51

Do you need the actual time of day?
Then see the sysvars page on the ESP for all the various time related variables you should be able to use anywhere, also in rules and in display plugins.

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Convert uptime seconds to days hours ect

#3 Post by budman1758 » 27 Jan 2021, 16:43

TD-er wrote: 27 Jan 2021, 10:51 Do you need the actual time of day?
Then see the sysvars page on the ESP for all the various time related variables you should be able to use anywhere, also in rules and in display plugins.
On the RPIEasy variables page the only one there is for system uptime is displayed as seconds. That is what I'm wanting to display as days, hours, minutes. Not looking for the current time of day. On the main page the system uptime is displayed in the "system info" area like I want.

EDIT: I see on an ESP unit in the variables page at the bottom "standard conversions" one to do what I want now. Cant figure out how to add that formula in the formula box in the plugin and get it to work. How do I format the actual formula? %value%=%c_s2dhms%(100000) doesn't work. (on ESP) Pointers?
"The glass is twice as big as it needs to be".

User avatar
enesbcs
Normal user
Posts: 587
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: Convert uptime seconds to days hours ect

#4 Post by enesbcs » 27 Jan 2021, 18:37

budman1758 wrote: 27 Jan 2021, 16:43 EDIT: I see on an ESP unit in the variables page at the bottom "standard conversions" one to do what I want now. Cant figure out how to add that formula in the formula box in the plugin and get it to work. How do I format the actual formula? %value%=%c_s2dhms%(100000) doesn't work. (on ESP) Pointers?
c_s2dhms is not currently supported in RPIEasy, but can be. c_m2dhm can be used for now.

I think it may works in this form as a formula:
%c_s2dhms%(%value%)

but easiest approach to use the current uptime variable and convert it (it can be added to the input field of display plugins):
%c_m2dhm%(%uptime%)

update: Uptime is in minutes, not seconds.

User avatar
enesbcs
Normal user
Posts: 587
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: Convert uptime seconds to days hours ect

#5 Post by enesbcs » 07 Feb 2021, 20:08

c_s2dhms added to RPIEasy at todays commit.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests