It is currently June 16th, 2021, 12:04 pm

MeasureUptime timer reset only after a reboot

Get help with installing and using Rainmeter.
KT Administrator
Posts: 5
Joined: April 16th, 2021, 6:50 am

MeasureUptime timer reset only after a reboot

Post by KT Administrator »

Hello everyone :welcome:

I'm new here. :)

I have a challenge with my setup in Rainmeter. Our company currently uses Dell Computers.

In my setup I have MeasureUptime, but this timer is reset only after a reboot. Not when I turn off the computer.

Is it some setting in the BIOS or is it some setting I have missed? Please can you help me. :great:

Best regards,

KT Administrator

Attached is my setup:

Code: Select all

##
[MeasureUptime]
Measure=Uptime
Format="%4!i! days, %3!i! hours, %2!i! min."
Update=1000

[MeterLabelUpTime]
Meter=String
MeterStyle=styleLeftTextBold
Y=87
X=0
Text="Our Text"

[MeterUpTime]
Meter=String
MeterStyle=styleLeftText
MeasureName=MeasureUptime
Y=87
X=140
Text="%1"
ToolTipTitle=OurText
ToolTipType=1
;ToolTipIcon=INFO
ToolTipText="OurText"
##
Last edited by balala on April 16th, 2021, 4:00 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are posting code snippets. It's the </> button.
User avatar
jsmorley
Developer
Posts: 21758
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: MeasureUptime timer reset only after a reboot

Post by jsmorley »

Windows 10 does a "hybrid" shutdown by default, which will not reset the system uptime when the system is restarted. You can solve this with code like this:

Code: Select all

[MeasureCurrentTime]
Measure=Time

[MeasureUserLoginTime]
Measure=Plugin
Plugin=SysInfo
SysInfoType=USER_LOGONTIME
UpdateDivider=-1

[MeasureUserUpTime]
Measure=UpTime
SecondsValue=([MeasureCurrentTime:] - [MeasureUserLoginTime:])
Format="%4!i!d %3!i!h %2!i!m"
DynamicVariables=1

[MeasureSystemUpTime]
Measure=UpTime
Format="%4!i!d %3!i!h %2!i!m"
What Windows 10 does on shutdown is unload all running applications, unload the active user account, and then "hibernate" the actual core system. This is so it starts up MUCH faster later. So a better way of knowing how long it has been since a shutdown is to look at how long the active user account has been running.

https://forum.rainmeter.net/viewtopic.php?f=122&t=27456&p=142448

Note that this will behave the same if you just sign out and back into any user account, rather than actually shutting down.
KT Administrator
Posts: 5
Joined: April 16th, 2021, 6:50 am

Re: MeasureUptime timer reset only after a reboot

Post by KT Administrator »

Hi jsmorley

Thank you for your reply.

I will try this and will get back to you.

Thanks.

BR

KT Administrator
KT Administrator
Posts: 5
Joined: April 16th, 2021, 6:50 am

Re: MeasureUptime timer reset only after a reboot

Post by KT Administrator »

Hi @jsmorley

Thank you for your reply.

I cannot get this to work.

Can you please take a look at the code and give me a reply with a code that I can use? :Whistle

Code: Select all

--#--
############################################
#-- USerUptime - Test 1 --#
############################################

[MeasureCurrentTime]
Measure=Time

[MeasureUserLoginTime]
Measure=Plugin
Plugin=SysInfo
SysInfoType=USER_LOGONTIME
UpdateDivider=-1

[MeasureUserUpTime]
Measure=UpTime
SecondsValue=([MeasureCurrentTime:] - [MeasureUserLoginTime:])
Format="%4!i!d %3!i!h %2!i!m"
DynamicVariables=1

[MeasureSystemUpTime]
Measure=UpTime
Format="%4!i!d %3!i!h %2!i!m"

[MeterLabelUserUpTime]
Meter=String
MeterStyle=styleLeftTextBold
Y=233
X=0
Text="UpTime"

[MeterUpTime]
Meter=String
MeterStyle=styleLeftText
MeasureName=MeasureUserUpTime
Y=233
X=140
Text="%1"
ToolTipTitle=UpTime
ToolTipType=1
;ToolTipIcon=INFO
ToolTipText="UpTime for the current user."
--#--
Thanks

BR,

KT Administrator
Last edited by jsmorley on April 26th, 2021, 11:11 am, edited 1 time in total.
Reason: Please use the code tags for embedding your code. It's the </> button at the top.
User avatar
jsmorley
Developer
Posts: 21758
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: MeasureUptime timer reset only after a reboot

Post by jsmorley »

Works fine for me... I just added some color and background to the text to be able to see it better. What is the problem you are running into?


1.png
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureUptime timer reset only after a reboot

Post by balala »

KT Administrator wrote: April 26th, 2021, 11:06 am Can you please take a look at the code and give me a reply with a code that I can use? :Whistle
As you see jsmorley says he added a background to the String meters. If the problem is the fact that the tooltips are not shown properly, this is caused by the fact that you have to hover the mouse over the lines of shown letters, which is not extremely easy.
To fix this add a SolidColor=0,0,0,1 option to both meters [MeterLabelUserUpTime] and [MeterUpTime]. This way the meters will properly react to mouse hovering and the tooltips will be shown.
Obviously you can use any not transparent color, 0,0,0,1 is just an example. Make sure the last (fourth) number is not 0. It is not visible, but mouse hovering works well with it.
KT Administrator
Posts: 5
Joined: April 16th, 2021, 6:50 am

Re: MeasureUptime timer reset only after a reboot

Post by KT Administrator »

Hi balala and jsmorley

Thank you for your time and effort for the help.

Found out that you can not run 2 MesaureUpTime at the same time. So I had to put a hashtag in front of the first one I had - after that the code I have put together worked with your help.

If I have to show both MesaureUserUpTime and MesaureUpTime, then I have to show both, right? Like this:

Code: Select all

## CODE - START ##

[MeasureCurrentTime]
Measure=Time

[MeasureUserLoginTime]
Measure=Plugin
Plugin=SysInfo
SysInfoType=USER_LOGONTIME
UpdateDivider=-1

[MeasureUserUpTime]
Measure=UpTime
SecondsValue=([MeasureCurrentTime:] - [MeasureUserLoginTime:])
Format="%4!i!d %3!i!h %2!i!m"
DynamicVariables=1

[MeasureSystemUpTime]
Measure=UpTime
Format="%4!i!d %3!i!h %2!i!m"

[MeterLabelUserUpTime]
Meter=String
MeterStyle=styleLeftTextBold
Y=233
X=0
Text="UserUpTimer"

[MeterUserUpTime]
Meter=String
MeterStyle=styleLeftText
MeasureName=MeasureUserUpTime
Y=233
X=140
Text="%1"
ToolTipTitle=UserUpTime
ToolTipType=1
;ToolTipIcon=INFO
ToolTipText="Since user logged on"

[MeterLabelSystemUpTime]
Meter=String
MeterStyle=styleLeftTextBold
Y=251
X=0
Text="SystemUpTime"

[MeterSystemUpTime]
Meter=String
MeterStyle=styleLeftText
MeasureName=MeasureSystemUpTime
Y=251
X=140
Text="%1"
ToolTipTitle=SystemUpTime
ToolTipType=1
;ToolTipIcon=INFO
ToolTipText="Since computer started."

## CODE - END ##
Last edited by balala on April 27th, 2021, 8:43 am, edited 1 time in total.
Reason: Please use <code> tags whenever are posting code snippets. It's the </> button.
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureUptime timer reset only after a reboot

Post by balala »

KT Administrator wrote: April 27th, 2021, 7:46 am Found out that you can not run 2 MesaureUpTime at the same time. So I had to put a hashtag in front of the first one I had - after that the code I have put together worked with your help.
Why couldn't you? They can be used, I doubt they couldn't be. However not sure how your code is like (supposing you were not talking about the posted code, since it has one single [MeasureUserUpTime] measure, which I suppose this is the measure you'd like to duplicate), so not sure what would you like to duplicate, give us (me) a few details, please.
KT Administrator wrote: April 27th, 2021, 7:46 am If I have to show both MesaureUserUpTime and MesaureUpTime, then I have to show both, right? Like this:
I suppose you are talking about the MesaureUserUpTime and MesaureSystemUpTime measures, because your code doesn't have a MesaureUpTime measure.
You can either use two string meters, or one single which shows the values of both measures. It's your decision. You've used two String meters ([MeterUserUpTime] and [MeterSystemUpTime]), but it can be done with one single such String meter as well. Please let me know if you don't know how but are interested.
User avatar
jsmorley
Developer
Posts: 21758
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: MeasureUptime timer reset only after a reboot

Post by jsmorley »

Perhaps the confusion is with having two measures that use the same functionality. This is fine, you just need to be sure that they have different [SectionNames].
KT Administrator
Posts: 5
Joined: April 16th, 2021, 6:50 am

Re: MeasureUptime timer reset only after a reboot

Post by KT Administrator »

balala wrote: April 27th, 2021, 9:03 am Why couldn't you? They can be used, I doubt they couldn't be. However not sure how your code is like (supposing you were not talking about the posted code, since it has one single [MeasureUserUpTime] measure, which I suppose this is the measure you'd like to duplicate), so not sure what would you like to duplicate, give us (me) a few details, please.
I had two MesaureUpTime, but I changed the new one to MesaureSystemUpTime. :great:
balala wrote: April 27th, 2021, 9:03 am I suppose you are talking about the MesaureUserUpTime and MesaureSystemUpTime measures, because your code doesn't have a MesaureUpTime measure.
You can either use two string meters, or one single which shows the values of both measures. It's your decision. You've used two String meters ([MeterUserUpTime] and [MeterSystemUpTime]), but it can be done with one single such String meter as well. Please let me know if you don't know how but are interested.
Thank you. I am interested to get the code. :thumbup:

Which Mesaure would yo recommend I should use? MesaureUpTime, MesaureUserUpTime or MesaureSystemUpTime? Or all? :)

Thank you!

BR,

KT Administrator