It is currently July 19th, 2019, 3:26 pm

Syncing skins

Help with creating, editing & fixing problems with skins
User avatar
qwerky
Posts: 181
Joined: April 10th, 2014, 12:31 am
Location: Canada

Syncing skins

qwerky » March 10th, 2019, 8:49 pm

Hi. I have made a clock skin. Now I am making a pendulum skin. The pendulum consists of ten LEDs (ellipse shape meters) arranged in an arc; of which only one is 'lit' at any given time, and the pendulum swings back and forth. Swinging the pendulum works fine; the problem is with timing.

The reason for having the pendulum in a separate skin, is because I wish the pendulum to update at 100ms intervals, and obviously don't wish the clock to update that fast; rather the clock should update at the default 1000ms rate. Thus the pendulum completes one full arc (either left-to-right, or right-to-left) each second. So the first question is, how to have the pendulum sync to the clock, so that the swing reaches the end of the arc (either left or right end), at the same instant that the clock seconds update.

As a sub-question to the above, if the pendulum were placed in the clock skin, and the update rate set to 100ms (specifically for the pendulum), then to have the remainder of the skin update at the usual 1000ms rate, would one need to place UpdateDivider=10 on every measure and meter in the skin? Is this a workable approach?

But the second, more serious problem, is that the pendulum seems to become increasingly more out of sync with the clock over time, either swinging faster or slower than the clock. Is this a known issue, that the rates of separate skins may be slightly off? Or is it rather somehow with the skins? If the latter, I can provide some code if it would be helpful.
User avatar
balala
Rainmeter Sage
Posts: 8376
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Syncing skins

balala » March 10th, 2019, 9:00 pm

qwerky wrote:
March 10th, 2019, 8:49 pm
The reason for having the pendulum in a separate skin, is because I wish the pendulum to update at 100ms intervals, and obviously don't wish the clock to update that fast; rather the clock should update at the default 1000ms rate. Thus the pendulum completes one full arc (either left-to-right, or right-to-left) each second. So the first question is, how to have the pendulum sync to the clock, so that the swing reaches the end of the arc (either left or right end), at the same instant that the clock seconds update.
Probably this is hard enough if those sections are in different skins. I'd combine them into one single and would use UpdateDivider options on the appropriate sections. Unless I misunderstood what you would like, this is a good approach I think.
qwerky wrote:
March 10th, 2019, 8:49 pm
As a sub-question to the above, if the pendulum were placed in the clock skin, and the update rate set to 100ms (specifically for the pendulum), then to have the remainder of the skin update at the usual 1000ms rate, would one need to place UpdateDivider=10 on every measure and meter in the skin? Is this a workable approach?
Or a DefaultUpdateDivider=10 option in the [Rainmeter] section.

Anyway a sample code would be helpful.
User avatar
qwerky
Posts: 181
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Syncing skins

qwerky » March 10th, 2019, 9:15 pm

balala wrote:
March 10th, 2019, 9:00 pm
Or a DefaultUpdateDivider=10 option in the [Rainmeter] section.
Somehow I missed this option, which appears to be designed exactly for the purpose I had in mind! :oops: Thanks for pointing it out. I will work on combining the skins with this option, and see how it works out. :great:
User avatar
balala
Rainmeter Sage
Posts: 8376
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Syncing skins

balala » March 10th, 2019, 9:18 pm

qwerky wrote:
March 10th, 2019, 9:15 pm
Somehow I missed this option,
This happens sometimes to all of us, I think.
User avatar
qwerky
Posts: 181
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Syncing skins

qwerky » March 10th, 2019, 10:41 pm

Having combined the two skins with the option discussed above, the pendulum now does indeed stay synced with the clock. However, the clock is now running slow with regard to the system time, so that about every fifteen to twenty seconds, the clock jumps two seconds instead of one, to sync back up with the system time. :(

The documentation does say not to rely on update rates to maintain accurate times, etc. My clock is based on Time measures, so that it always does come back into sync; it is just the updating that gets out of whack, and in its present state is not usable. Without the pendulum, though, the clock updates perfectly fine.

Is there anything else that can be done, or is using a fast-updating pendulum just not going to work? :???:
User avatar
jsmorley
Developer
Posts: 19294
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Syncing skins

jsmorley » March 11th, 2019, 12:43 am

qwerky wrote:
March 10th, 2019, 10:41 pm
Having combined the two skins with the option discussed above, the pendulum now does indeed stay synced with the clock. However, the clock is now running slow with regard to the system time, so that about every fifteen to twenty seconds, the clock jumps two seconds instead of one, to sync back up with the system time. :(

The documentation does say not to rely on update rates to maintain accurate times, etc. My clock is based on Time measures, so that it always does come back into sync; it is just the updating that gets out of whack, and in its present state is not usable. Without the pendulum, though, the clock updates perfectly fine.

Is there anything else that can be done, or is using a fast-updating pendulum just not going to work? :???:
I personally doubt this will ever be pleasing, as Update is just not a reliable function of "time" in any sense of a clock, and the lowest unit of value you can track in a Time measure is a second.

I actually tried this in a skin many, many years ago, and gave up on it. The best I could get synchronizing the animation with the clock was "more or less".


GIF.gif
You do not have the required permissions to view the files attached to this post.
Yincognito
Posts: 653
Joined: February 27th, 2015, 2:38 pm

Re: Syncing skins

Yincognito » March 11th, 2019, 12:07 pm

jsmorley wrote:
March 11th, 2019, 12:43 am
I personally doubt this will ever be pleasing, as Update is just not a reliable function of "time" in any sense of a clock, and the lowest unit of value you can track in a Time measure is a second.

I actually tried this in a skin many, many years ago, and gave up on it. The best I could get synchronizing the animation with the clock was "more or less".
I think a better way of syncing would be to just use Windows timestamp number value (not the Rainmeter formatted one), since that's expressed in nanoseconds, as per manual. If you get the nanoseconds once every 100 Rainmeter milliseconds and change the pendulum position as a function of how many nanoseconds have passed since the last skin update, this would in theory be as precise as possible.

Of course, this approach could be slightly changed to re-sync once a second, but based on the same values in nanoseconds (or better said, based on the number of milliseconds calculated using actual Windows timestamp number values).
User avatar
jsmorley
Developer
Posts: 19294
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Syncing skins

jsmorley » March 11th, 2019, 1:14 pm

Actually, the timestamp is "measured" in into a structure that is based on 100-nanosecond (one ten-millionth of a second) increments, but "expressed" in 1-second increments. So what is returned as the timestamp for a Time measure is the number of seconds from January 1, 1601.

I'll make the manual more clear on this...

You can't return a value for the time that is at a granularity of less than one second.
Yincognito
Posts: 653
Joined: February 27th, 2015, 2:38 pm

Re: Syncing skins

Yincognito » March 11th, 2019, 1:52 pm

jsmorley wrote:
March 11th, 2019, 1:14 pm
I'll make the manual more clear on this...You can't return a value for the time that is at a granularity of less than one second.
Good idea. But just out of curiosity, if what the manual said regarding the nanoseconds was true (i.e. before your pending modifications to it), could my solution have been a valid one?
User avatar
jsmorley
Developer
Posts: 19294
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Syncing skins

jsmorley » March 11th, 2019, 1:57 pm

Yincognito wrote:
March 11th, 2019, 1:52 pm
Good idea. But just out of curiosity, if what the manual said regarding the nanoseconds was true (i.e. before your pending modifications to it), could my solution have been a valid one?
Not entirely sure. Sorta, I think. While if a time measure returned milliseconds (for instance) you could say "there have been XX milliseconds between these two events", the problem comes with the fact that you just can't "update" a skin on a reliable, timed basis. So if you were to for instance update the skin every 100 milliseconds, and show a counter that displayed the time with milliseconds on it, that would from time to time "skip" values, since the "time" would be reliable, but when it is measured would not be.