It is currently June 16th, 2021, 10:38 am

MeasureUptime timer reset only after a reboot

Get help with installing and using Rainmeter.
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 »

I use both the system uptime and user uptime in my skin:


1.png

Code: Select all

;[UPTIME]==================================

[MeasureGetUserName]
Measure=Plugin
Plugin=SysInfo
SysInfoType=USER_NAME
UpdateDivider=-1

[MeasureCurrentTime]
Measure=Time

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

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

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

Now I don't actually shutdown my desktop computer all that often, so the system and user uptime values are often more or less the same, but it is of some interest to see when the computer was "shutdown", which does not reset the system uptime, and when the system was "restarted", which does. If I was constrained on room in the skin, and could only use one, it would be the user uptime.
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 28th, 2021, 1:15 pm I had two MesaureUpTime, but I changed the new one to MesaureSystemUpTime. :great:
You can use two Uptime measures, but what you have to take care about is to have individual names for all sections. If there are two sections with the same name, the second one won't work, not even if they are different types. In same way nor more variables can have the same name and nor options can be added more than one time to a section. That's why on some kind of meters, there are some options which have to be numbered. For instance on a String meter you can't have two MeasureName options, but can have a MeasureName and a MeasureName2 (or even more, if needed - see below).
KT Administrator wrote: April 28th, 2021, 1:15 pm Thank you. I am interested to get the code. :thumbup:
Here is an example. Let's say you have in your code the following three measures:

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
(copied from your code).
Now if you want to show the values returned by these measures, you have two possibilities:
  • You either will use three String meters, for example the following ones:

    Code: Select all

    [StringStyle]
    Padding=15,5,15,5
    FontColor=220,220,220
    FontEffectColor=0,0,0
    StringEffect=Shadow
    SolidColor=0,0,0,150
    FontSize=8
    FontFace=Segoe UI
    StringStyle=BOLD
    StringAlign=LEFT
    AntiAlias=1
    
    [MeterCurrentTime]
    Meter=STRING
    MeterStyle=StringStyle
    MeasureName=MeasureCurrentTime
    X=0
    Y=0
    Text=Current time: %1
    
    [MeterUserLoginTime]
    Meter=STRING
    MeterStyle=StringStyle
    MeasureName=MeasureUserLoginTime
    X=0r
    Y=5R
    Text=Login time: %1
    
    [MeterUserUptime]
    Meter=STRING
    MeterStyle=StringStyle
    MeasureName=MeasureUserUpTime
    X=0r
    Y=5R
    Text=User uptime: %1
    (see the String meters - [MeterCurrentTime], [MeterUserLoginTime] and [MeterUserUptime] - and the style section - [StringStyle] - used to shorten the code).
  • Or you have to use one single String meter, but in this case you have to add all three measures to be shown in the same meter:

    Code: Select all

    [StringStyle]
    Padding=15,5,15,5
    FontColor=220,220,220
    FontEffectColor=0,0,0
    StringEffect=Shadow
    SolidColor=0,0,0,150
    FontSize=8
    FontFace=Segoe UI
    StringStyle=BOLD
    StringAlign=LEFT
    AntiAlias=1
    
    [MeterCurrentTime]
    Meter=STRING
    MeterStyle=StringStyle
    MeasureName=MeasureCurrentTime
    MeasureName2=MeasureUserLoginTime
    MeasureName3=MeasureUserUpTime
    X=0
    Y=0
    Text=Current time: %1#CRLF#Login time: %2#CRLF#User uptime: %3
    Just to have the same style I kept the [StringStyle] section. As you can see this time there is one single String meter ([MeterCurrentTime]), but this one has three numbered MeasureName options (MeasureName=MeasureCurrentTime, MeasureName2=MeasureUserLoginTime and MeasureName3=MeasureUserUpTime).
Now which of these solutions do you prefer, is absolutely up to you. Practically there is no difference between them, use which one you like more.
KT Administrator wrote: April 28th, 2021, 1:15 pm Which Mesaure would yo recommend I should use? MesaureUpTime, MesaureUserUpTime or MesaureSystemUpTime? Or all? :)
I can't and don't recommend none of them. Which one do you use depends on what would you like to show on your skin. No one can make a recommandation, because it's your decision what to show.