It is currently January 29th, 2023, 8:16 pm

Sunrise-Moonset

Weather skins
User avatar
balala
Rainmeter Sage
Posts: 14928
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Sunrise-Moonset

Post by balala »

This scripts are very good, but maybe they have a bug (?): the don't adjust the calculated moments acording with the daylight saving times. On summer perriod they should add 1 hour to the determined moments. I tried to correct this, but had no succes: I've read the proper registry key (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias). This value is 4294967116 on summertime and 4294967176 on wintertime. I have this values in the scripts, but can't find where and how to use them. If somebody has any idea about this, please share it.

Thank you
User avatar
Mordasius
Posts: 1099
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Sunrise-Moonset

Post by Mordasius »

I think the daylight savings time problem has been corrected with the latest updates. Please download the skins again and let me know if the times are a little closer to those expected for wherever you are.
User avatar
Mirage
Posts: 23
Joined: September 11th, 2012, 3:36 am

Re: Sunrise-Moonset

Post by Mirage »

Mordasius wrote:I think the daylight savings time problem has been corrected with the latest updates. Please download the skins again and let me know if the times are a little closer to those expected for wherever you are.
I have verified that the new script does handle DST correctly, as it grabs the system date, time, time zone, and DST from the users system. But it also make the "tZone=" variable in the settings ini mute. Changing the tZone has no effect. Not necessarily a bad thing, just something to consider.

edit - Sorry for the confussion, I only verified this 100% in StonesMoonIII scripts, but at first glance it seems to be the same in SunMoon as well.
User avatar
Mordasius
Posts: 1099
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Sunrise-Moonset

Post by Mordasius »

Mirage wrote: It also make the "tZone=" variable in the settings ini mute. Changing the tZone has no effect. Not necessarily a bad thing, just something to consider.
That's right, the tZone variable in UserSettings.inc is only there for testing purposes and it won't be used unless you over-write it in the lua script.

tZone was included as a user variable because I couldn't think of any other way to test the sun and moon rise / set times in different places if I was using the o.s. time zone setting for my location.
User avatar
Mirage
Posts: 23
Joined: September 11th, 2012, 3:36 am

Re: Sunrise-Moonset

Post by Mirage »

Did notice one more interesting thing in StonesMoonIII. Yesterday, March31st, Moonrise was reported as "Last Night". This threw me for a loop until I realized that Moonrise for the 31st, would not actually happen till April 1st at 00:35. I'm working on correcting this, or at least giving the user the time of Moonrise/Set and some indicator as to when it will actually happen, like ("00:25 Tomorrow", or for those nearer the poles, "Not Today". But I've noticed that SunMoon handles this a little better, so I may look at your scripts there and see if I can use it to solve this problem. Thanks for the education!
User avatar
Mordasius
Posts: 1099
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Sunrise-Moonset

Post by Mordasius »

What I've done for the Tellurion is modify the scripts to calculate the previous set and next rise of the sun and moon. Nothing too complicated but it does mean a re-work of the lua scripts to return values based on Julian dates for the previous, current and next days.

That way you always have the correct previous and next rise / set times to display in the tooltip and use to calculate the position for plotting the sun/moon image.

I'll post the Tellurion once I've succeded in up-ending a certain Easter Bunnie who is far too sweet to be stewed. :-)
User avatar
Mirage
Posts: 23
Joined: September 11th, 2012, 3:36 am

Re: Sunrise-Moonset

Post by Mirage »

No problem. Whenever you have time. This exercise has been fun and very educational. I look forward to seeing your Tellurion.
Stone
Posts: 25
Joined: March 12th, 2013, 8:51 am
Location: Copenhagen / Denmark

Re: Sunrise-Moonset

Post by Stone »

- Thanks for discovering/correcting the DST-error Balala and Mordasius; It's nice to know that you are awake when i'm not :oops:

- and it's good to see that your elongation approximation works Mordasius (I took a quick look in Benjam's iohelix source, and it looks a little too complicated).
- Stone
User avatar
balala
Rainmeter Sage
Posts: 14928
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Sunrise-Moonset

Post by balala »

Mordasius wrote:I think the daylight savings time problem has been corrected with the latest updates. Please download the skins again and let me know if the times are a little closer to those expected for wherever you are.
Yes, it indeed has been corrected and now it works well.
hardwired
Posts: 11
Joined: August 16th, 2022, 5:59 pm

Re: Sunrise-Moonset

Post by hardwired »

Never been this late to a party, but looking for ephemeris and astronomy Rainmeter skins using lua scripts instead of webparsers I found this and the planets lua from the Astronomy skin. The sun and moon lua's kindly posted (thank you) in this thread are almost perfect for my needs, except for the leading zero's in the hours. I've been trying to use a substitute to no avail, (but I'm by no means a Rainmeter scripting expert) and I looked around the lua file although I don't know anything about scripting and programming in general. There's this 'ToTime' function with a %02d in there, probably for the leading zeros for the minutes. I tried messing around, of course without luck. How do I change the lua to add zero's to the hours as well, for both the latest Moon and Sun lua's posted here?