It is currently October 18th, 2024, 5:31 am

Simple countdown timer

Get help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 1835
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

:welcome:
Last edited by sl23 on September 4th, 2024, 7:05 am, edited 1 time in total.
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8485
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

dvo wrote: July 29th, 2021, 12:24 pm most of the time it's for time to show correctly instead of skipping seconds. :welcome:
Never bothered (and will never bother) with such things. My time skin is updating at 1000 ms and doesn't skip seconds, unless, of course, the CPU is very busy. But then, when the CPU is really very busy, these kind of minor "issues" will happen even if the update rate is lower, so you end up having the same "problem". It's not like I'm watching the clock every second anyway, so if it happens once a day or so when I'm not paying attention to it, it's not such a big deal... :confused:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Active Colors
Moderator
Posts: 1319
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Simple countdown timer

Post by Active Colors »

Yincognito wrote: July 29th, 2021, 12:35 pm Never bothered (and will never bother) with such things. My time skin is updating at 1000 ms and doesn't skip seconds, unless, of course, the CPU is very busy. But then, when the CPU is really very busy, these kind of minor "issues" will happen even if the update rate is lower, so you end up having the same "problem". It's not like I'm watching the clock every second anyway, so if it happens once a day or so when I'm not paying attention to it, it's not such a big deal... :confused:
In theory when the Update equals 1000 the skin shouldn't skip seconds because the skin updates with the same speed as the seconds.
User avatar
jsmorley
Developer
Posts: 22861
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Simple countdown timer

Post by jsmorley »

Active Colors wrote: July 29th, 2021, 1:22 pm In theory when the Update equals 1000 the skin shouldn't skip seconds because the skin updates with the same speed as the seconds.
In theory. What Update=1000 means is that Rainmeter will "try" to update once every 1000 milliseconds. There is no absolute guarantee that it will always be able to do so, it depends a bit on what else your system and Rainmeter are busy doing at any given time.

Do NOT equate Update to seconds on a clock. It won't always work.

A skin that has Update=1000 and counts from 0 to 100 in a measure is in no way certain to be at 100 in 100 seconds on the clock. In a practical sense this isn't going to matter, unless you try to use Update to control some very exact amount of "elapsed time". Update is "more or less". For exact measurements of elapsed time, I would always use a Time measure, where if it DOES "skip" an Update, it will "catch up". I'd probably set Update=900 or Update=950 or something, to reduce any "skipped" or "jerky" seconds in the visible display of the Time measure.

It's perfectly fine to consider Update=1000 to mean "once a second". Just keep in mind it really means "pretty much once a second".
User avatar
Active Colors
Moderator
Posts: 1319
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Simple countdown timer

Post by Active Colors »

jsmorley wrote: July 29th, 2021, 1:24 pm In theory. What Update=1000 means is that Rainmeter will "try" to update once every 1000 milliseconds. There is no absolute guarantee that it will always be able to do so, it depends a bit on what else your system and Rainmeter are busy doing at any given time.

Do NOT equate Update to seconds on a clock. It won't always work.

A skin that has Update=1000 and counts from 0 to 100 in a measure is in no way certain to be at 100 in 100 seconds on the clock. In a practical sense this isn't going to matter, unless you try to use Update to control some very exact amount of "elapsed time". Update is "more or less". For exact measurements of elapsed time, I would always use a Time measure, where if it DOES "skip" an Update, it will "catch up". I'd probably set Update=900 or Update=950 or something, to reduce any "skipped" or "jerky" seconds in the visible display of the Time measure.

It's perfectly fine to consider Update=1000 to mean "once a second". Just keep in mind it really means "pretty much once a second".
Thanks for the correction! I am myself have been wondering why there is such a case of jerky seconds. After you explained I see now.
User avatar
jsmorley
Developer
Posts: 22861
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Simple countdown timer

Post by jsmorley »

Yes. Here is an example of where I'm using Time measures to track seconds, while setting Update very low in order to eliminate any "skipping / jerky" behavior. There is a lot going on once a second on the "clock", and I don't want Rainmeter to fall behind at any point:

Code: Select all

[Rainmeter]
Update=50
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!SetVariable CurrentHours "[MeasureHours]"][!SetVariable CurrentMinutes "[MeasureMinutes]"][!SetVariable CurrentSeconds "[MeasureSeconds]"][!UpdateMeter *][!Redraw]

[Variables]
LinesColor=0,0,0,255
NumberColor=255,255,255,255
BackColor=19,43,77,255
CurrentHoursY=2
NewHoursY=-40
CurrentMinutesY=2
NewMinutesY=-40
CurrentSecondsY=2
NewSecondsY=-40
U=[!UpdateMeasureGroup Sliders][!UpdateMeterGroup Numbers][!Redraw]

; Measures

[MeasureHours]
Measure=Time
Format=%I
OnChangeAction=[!CommandMeasure HoursSlide "Execute 1"]

[MeasureMinutes]
Measure=Time
Format=%M
OnChangeAction=[!CommandMeasure MinutesSlide "Execute 1"]

[MeasureSeconds]
Measure=Time
Format=%S
OnChangeAction=[!CommandMeasure SecondsSlide "Execute 1"]

[HoursSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
IgnoreWarnings=1
ActionList1=SetThem | Wait 1 | Repeat SlideThem, 20, 21 | Wait 1| SwapThem
SetThem=[!SetVariable CurrentHoursY "2"][!SetVariable NewHoursY "-40"]#U#
SlideThem=[!SetVariable CurrentHoursY "(Clamp(#CurrentHoursY#+2,2,45))"][!SetVariable NewHoursY "(Clamp(#NewHoursY#+2,-40,2))"]#U#
SwapThem=[!SetVariable CurrentHoursY "2"][!SetVariable NewHoursY "-40][!SetVariable CurrentHours "[MeasureHours]"]#U#
UpdateDivider=-1
DynamicVariables=1

[MinutesSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
IgnoreWarnings=1
ActionList1=SetThem | Wait 1 | Repeat SlideThem, 20, 21 | Wait 1| SwapThem
SetThem=[!SetVariable CurrentMinutesY "2"][!SetVariable NewMinutesY "-40"]#U#
SlideThem=[!SetVariable CurrentMinutesY "(Clamp(#CurrentMinutesY#+2,2,45))"][!SetVariable NewMinutesY "(Clamp(#NewMinutesY#+2,-40,2))"]#U#
SwapThem=[!SetVariable CurrentMinutesY "2"][!SetVariable NewMinutesY "-40][!SetVariable CurrentMinutes "[MeasureMinutes]"]#U#
UpdateDivider=-1
DynamicVariables=1

[SecondsSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
IgnoreWarnings=1
ActionList1=SetThem | Wait 1 | Repeat SlideThem, 20, 21 | Wait 1| SwapThem
SetThem=[!SetVariable CurrentSecondsY "2"][!SetVariable NewSecondsY "-40"]#U#
SlideThem=[!SetVariable CurrentSecondsY "(Clamp(#CurrentSecondsY#+2,2,45))"][!SetVariable NewSecondsY "(Clamp(#NewSecondsY#+2,-40,2))"]#U#
SwapThem=[!SetVariable CurrentSecondsY "2"][!SetVariable NewSecondsY "-40][!SetVariable CurrentSeconds "[MeasureSeconds]"]#U#
UpdateDivider=-1
DynamicVariables=1

; Meters

[MeterContainer]
Meter=Shape
Shape=Rectangle 1,1,126,43 | StrokeWidth 2
UpdateDivider=-1

[MeterNewHours]
Meter=String
Group=Numbers
MeasureName=MeasureHours
W=30
H=32
X=22
Y=#NewHoursY#
StringAlign=Center
FontFace=Fira Sans
FontSize=20
FontColor=#NumberColor#
SolidColor=#BackColor#
Padding=5,5,5,5
AntiAlias=1
Container=MeterContainer
UpdateDivider=-1
DynamicVariables=1

[MeterCurrentHours]
Meter=String
Group=Numbers
W=30
H=32
X=22
Y=#CurrentHoursY#
StringAlign=Center
FontFace=Fira Sans
FontSize=20
FontColor=#NumberColor#
SolidColor=#BackColor#
Padding=5,5,5,5
AntiAlias=1
Text=#CurrentHours#
Container=MeterContainer
UpdateDivider=-1
DynamicVariables=1

[MeterNewMinutes]
Meter=String
Group=Numbers
MeasureName=MeasureMinutes
W=30
X=64
Y=#NewMinutesY#
H=32
StringAlign=Center
FontFace=Fira Sans
FontSize=20
FontColor=#NumberColor#
SolidColor=#BackColor#
Padding=5,5,5,5
AntiAlias=1
Container=MeterContainer
UpdateDivider=-1
DynamicVariables=1

[MeterCurrentMinutes]
Meter=String
Group=Numbers
MeasureName=MeasureMinutes
W=30
X=64
Y=#CurrentMinutesY#
H=32
StringAlign=Center
FontFace=Fira Sans
FontSize=20
FontColor=#NumberColor#
SolidColor=#BackColor#
Padding=5,5,5,5
AntiAlias=1
Text=#CurrentMinutes#
Container=MeterContainer
UpdateDivider=-1
DynamicVariables=1

[MeterNewSeconds]
Meter=String
Group=Numbers
MeasureName=MeasureSeconds
W=30
X=106
Y=#NewSecondsY#
H=32
StringAlign=Center
FontFace=Fira Sans
FontSize=20
FontColor=#NumberColor#
SolidColor=#BackColor#
Padding=5,5,5,5
AntiAlias=1
Container=MeterContainer
UpdateDivider=-1
DynamicVariables=1

[MeterCurrentSeconds]
Meter=String
Group=Numbers
W=30
X=106
Y=#CurrentSecondsY#
H=32
StringAlign=Center
FontFace=Fira Sans
FontSize=20
FontColor=#NumberColor#
SolidColor=#BackColor#
Padding=5,5,5,5
AntiAlias=1
Text=#CurrentSeconds#
Container=MeterContainer
UpdateDivider=-1
DynamicVariables=1

[MeterOutline]
Meter=Shape
Shape=Rectangle 1,1,126,43 | StrokeWidth 2 | Stroke Color #LinesColor# | Fill Color 0,0,0,0
Shape2=Line 43,2,43,43 | StrokeWidth 2 | Stroke Color #LinesColor#
Shape3=Line 85,2,85,43 | StrokeWidth 2 | Stroke Color #LinesColor#
UpdateDivider=-1

Animation.gif
You do not have the required permissions to view the files attached to this post.
User avatar
sl23
Posts: 1835
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

:welcome:
Last edited by sl23 on September 4th, 2024, 7:06 am, edited 1 time in total.
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8485
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

As always, jsmorley is correct: there are times when you really want those seconds to be accurate (e.g. timers, AT driven skins, etc), and Rainmeter can't follow precisely the actual clock. For those cases, a lower update rate pays off and yields the expected result. I might have been lucky or something up until now, as I never needed to do it, since for some reason my time skin doesn't seem to miss a beat, so to speak. Either that, or it's doing it when the owner is not looking... :sly:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16669
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Simple countdown timer

Post by balala »

sl23 wrote: July 29th, 2021, 12:03 pm Can I just ask again as you probably missed it, why such a fast update rate?
Not sure why did I set it to such a low value (note that as said, the skin is almost 9 years old).
User avatar
sl23
Posts: 1835
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

:welcome:
Last edited by sl23 on September 4th, 2024, 7:07 am, edited 1 time in total.
57686174 77696C6C 6265 77696C6C 6265