It is currently April 23rd, 2024, 4:53 pm

Having a problem with the Uptime Measure

Get help with creating, editing & fixing problems with skins
PoohSanders
Posts: 7
Joined: August 28th, 2020, 1:05 am

Having a problem with the Uptime Measure

Post by PoohSanders »

I'm having a problem getting the uptime measure to display the correct hours. If i have everything on 1 line it works fine...
Format="%4!i!d %3!i!h %2!i!m"
...this works fine. But, if I try to seperate them onto individual lines, it goes wrong. I DID use AddDaysToHours=1 and it worked just fine for a few hours, but reverted back to the wrong hours, now I can't get it back. Right now it should say "2 days 21 hours 42 minutes" but I get "2 days 69 hours 42 minutes"

Here's what I have right now...

Code: Select all

[Rainmeter]
  Update=1000

[Background]
  Meter=IMAGE
  ImageName=face.png
  X=0
  Y=0
  H=160
  W=160

;--- MEASURES ------------------------------------
[MeasureUpTimeD]
  Measure=Uptime
  Format="%4!i!"

[MeasureUpTimeH]
  Measure=Uptime
  Format="%3!i!"
  AddDaysToHours=1
  
[MeasureUpTimeM]
  Measure=Uptime
  Format="%2!i!"


;--- METERS ------------------------------------
  
[MeterUpTimeTextD]
  MeasureName=MeasureUpTimeD
  Meter=String
  FontColor=230,230,230,255
  FontFace=Zag Bold
  FontSize=11
  StringAlign=CENTER
  StringStyle=BOLD
  AntiAlias=1
  X=62
  Y=44
  Text="%1"

[MeterUpTimeTextH]
  MeasureName=MeasureUpTimeH
  Meter=String
  FontColor=230,230,230,255
  FontFace=Zag Bold
  FontSize=11
  StringAlign=CENTER
  StringStyle=BOLD
  AntiAlias=1
  X=45
  Y=62
  Text="%1"

[MeterUpTimeTextM]
  MeasureName=MeasureUpTimeM
  Meter=String
  FontColor=230,230,230,255
  FontFace=Zag Bold
  FontSize=11
  StringAlign=CENTER
  StringStyle=BOLD
  AntiAlias=1
  X=90
  Y=62
  Text="%1"

...not sure where to go from here.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Having a problem with the Uptime Measure

Post by mak_kawa »

Hi PoohSanders

I am not using Uptime measure with such separate format... but reading the document for the measure, I think it is an expected behavior. Document says;
AddDaysToHours
If set to 1 and if %4 (days) is not used in the Format option, %3 (hours) is incremented by days * 24.
You don't use "%4" in [MeasureUpTimeH] measure, so hours is incremented by days*24 (2*24=48) to 69.
And you divided Day part with [MeasureUpTimeD] measure, so %4 in the measure is 2.
Finally, output is 2 and 69 and 42.

I wonder why you have to separate Uptime measure to three? If you want to display DMH to separate line, you can insert linefeed constant #CRLF# as Format="%4!i!d#CRLF#%3!i!h#CRLF#%2!i!m".

If I am misunderstanding at all, sorry.
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Having a problem with the Uptime Measure

Post by CodeCode »

If you are using separate lines you should consider using the standard Format Codes

I apologise if this is incorrect since the uptime measure seems to always have the complex format codes rather than the above, but perhaps in this case it may be just that, simpler format codes. :Whistle
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Having a problem with the Uptime Measure

Post by mak_kawa »

Hi CodeCode

I am not sure, but the format code of the Uptime measure is different from those of the Time measure? If I am wrong, sorry.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Having a problem with the Uptime Measure

Post by mak_kawa »

Hi PoohSanders

If you aim to display Day, Hour, Minutes in flexible layout with separate measures/meters, I have another idea, but didn't test actually. If it doesn't work, sorry.

Add %4 format code to the [MeasureUpTimeH] measure, so day value is not incremented to hour value, and remove day part by substitution like as;

Code: Select all

[MeasureUpTimeH]
Measure=Uptime
Format="%4!i!Day%3!i!"
RegExpSubstitute=1
Substitute="^.*Day":""
 
Or... if this code doesn't work for Uptime measure, handle output string to another String measure like as;

Code: Select all

[MeasureUpTimeH]
Measure=Uptime
Format="%4!i!Day%3!i!"

[MeasureUpTimeHSubst]
Measure=String
String=[MeasureUpTimeH]
RegExpSubstitute=1
Substitute="^.*Day":""
DynamicVariables=1
PoohSanders
Posts: 7
Joined: August 28th, 2020, 1:05 am

Re: Having a problem with the Uptime Measure

Post by PoohSanders »

mak_kawa wrote: October 15th, 2020, 6:04 am
I wonder why you have to separate Uptime measure to three? If you want to display DMH to separate line, you can insert linefeed constant #CRLF# as Format="%4!i!d#CRLF#%3!i!h#CRLF#%2!i!m".

If I am misunderstanding at all, sorry.
The numbers are in a triangle, days on top and hours and minutes on the bottom. It's ok though I figured it out. It should be AddDaysToHours=0
I read the help wrong, it should be a 0 not a 1.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Having a problem with the Uptime Measure

Post by mak_kawa »

Ah... 0 ... I am totally clumsy. :-) Sorry!
User avatar
balala
Rainmeter Sage
Posts: 16162
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Having a problem with the Uptime Measure

Post by balala »

mak_kawa wrote: October 15th, 2020, 7:16 am I am not sure, but the format code of the Uptime measure is different from those of the Time measure?
Yep, they are for sure. In an Uptime measure the formats for days, hours, minutes and seconds are these: %4, %3, %2 and %1 accordingly. The formats of the same elements in Time measures are %d, %H (or %I in 12 hours format), %M respectivelly %S. However note that these formats mean and are a used a little bit differently in the two type of measures.