Just for reference, since the problem seems to be solved and a workaround appears to have been found - maybe it'll be a good starting point for others...
Code:
Code: Select all
[Variables]
Update=25
NTStep=300
Radius=90
ImageW=32
DialSW=2
Offset=(PI/20)
SRH=6
SRM=26
SRS=15
Sunrise=(#SRH#*60*60+#SRM#*60+#SRS#)
SSH=20
SSM=4
SSS=45
Sunset=(#SSH#*60*60+#SSM#*60+#SSS#)
MRH=16
MRM=36
MRS=17
Moonrise=(#MRH#*60*60+#MRM#*60+#MRS#)
MSH=0
MSM=14
MSS=5
Moonset=(#MSH#*60*60+#MSM#*60+#MSS#)
NTH=8
NTM=12
NTS=35
Nowtime=(#NTH#*60*60+#NTM#*60+#NTS#)
[Rainmeter]
Update=#Update#
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,80
LeftMouseUpAction=[!ToggleMeasure Counter]
---Measures---
[Counter]
Disabled=1
Measure=Calc
Formula=((Counter+#NTStep#)%(24*60*60))
OnUpdateAction=[!SetVariable Nowtime [Counter]][!SetVariable NTH (Trunc([Counter]/(60*60)))][!SetVariable NTM (Trunc(([Counter]%(60*60))/60))][!SetVariable NTS ([Counter]%60)]
[Suntime]
Measure=Calc
Formula=(((24*60*60)+#Sunset#-#Sunrise#)%(24*60*60))
DynamicVariables=1
[Moontime]
Measure=Calc
Formula=(((24*60*60)+#Moonset#-#Moonrise#)%(24*60*60))
DynamicVariables=1
[SinceSunrise]
Measure=Calc
Formula=((((((24*60*60)+#Nowtime#-#Sunrise#)%(24*60*60))*((12*60*60)/[Suntime]))>=(12*60*60))?(((12*60*60))+((((24*60*60)+#Nowtime#-#Sunset#)%(24*60*60))*((12*60*60)/((24*60*60)-[Suntime])))):((((24*60*60)+#Nowtime#-#Sunrise#)%(24*60*60))*((12*60*60)/[Suntime])))
MaxValue=(24*60*60)
DynamicVariables=1
[SinceMoonrise]
Measure=Calc
Formula=((((((24*60*60)+#Nowtime#-#Moonrise#)%(24*60*60))*((12*60*60)/[Moontime]))>=(12*60*60))?(((12*60*60))+((((24*60*60)+#Nowtime#-#Moonset#)%(24*60*60))*((12*60*60)/((24*60*60)-[Moontime])))):((((24*60*60)+#Nowtime#-#Moonrise#)%(24*60*60))*((12*60*60)/[Moontime])))
MaxValue=(24*60*60)
DynamicVariables=1
---Meters---
[UpArc]
Meter=Roundline
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
StartAngle=(PI)
RotationAngle=(PI)
LineStart=(#Radius#-#DialSW#/2)
LineLength=(#Radius#+#DialSW#/2)
LineColor=255,255,255,255
Solid=1
AntiAlias=1
DynamicVariables=1
[DownArc]
Meter=Roundline
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
StartAngle=(0)
RotationAngle=(PI)
LineStart=(#Radius#-#DialSW#/2)
LineLength=(#Radius#+#DialSW#/2)
LineColor=96,96,96,255
Solid=1
AntiAlias=1
DynamicVariables=1
[Sun]
Meter=Rotator
MeasureName=SinceSunrise
ImageName=#@#Sun.png
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
OffsetX=(-#Radius#+#ImageW#/2)
OffsetY=(#ImageW#/2)
StartAngle=(PI)
RotationAngle=(PI*2)
DynamicVariables=1
[Moon]
Meter=Rotator
MeasureName=SinceMoonrise
ImageName=#@#Moon.png
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
OffsetX=(-#Radius#+#ImageW#/2)
OffsetY=(#ImageW#/2)
StartAngle=(PI)
RotationAngle=(PI*2)
DynamicVariables=1
[Text]
Meter=String
X=(#CURRENTCONFIGWIDTH#/2)
Y=(#CURRENTCONFIGHEIGHT#/2)
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
FontFace=Tahoma
FontColor=255,255,255,255
FontSize=8
StringAlign=CenterCenter
StringEffect=Shadow
FontEffectColor=0,0,0,255
AntiAlias=1
Text="Sun = #SRH#:#SRM#:#SRS# - #SSH#:#SSM#:#SSS##CRLF#Moon = #MRH#:#MRM#:#MRS# - #MSH#:#MSM#:#MSS##CRLF#Now = #NTH#:#NTM#:#NTS##CRLF#Sun: [SinceSunrise:%,2]%, Moon: [SinceMoonrise:%,2]%"
DynamicVariables=1
Preview:
ezgif.com-optimize.gif
I added a counter and set the update to 25 milliseconds to be able to animate the whole thing (basically, only the 'now' time changes) on a left mouse click - feel free to remove it if you like.
As mentioned before:
- times are hardcoded in the
[Variables], but they can be parsed from someplace else if needed (just make sure they are
the times of today, in other words if you use time measures, subtract the 00:00:00 aka 12 AM of the day they represent from the Time measures to get the "timestamps" used here; or, you can just simply extract the hours, minutes and seconds from the parsed strings and it'll be the same result)
- the sun/moon set before the sun/moon rise (which can happen, depending on what and how you parse those times and from what sources) are fully accounted here, since I added and got the modulo of a full day, i.e.
(24*60*60), when subtracting times in the formulas; the current code even has the moonset happening before the moonrise, to better see how the skin reacts to it
- since the 'up' (celestial body risen) and 'down' (celestial body set) arcs are half circles but the daytime / moontime widely vary over the course of seasons and such, meaning the actual 'up' interval of sun / moon differ from their 'down' intervals while the arcs representing them in this skin are equal at 180 degrees each, the sun and moon will appear to move either faster or slower while they traverse one of these arcs compared to the other (for example, if the day length is 14 hours and the night length is 10 hours, the sun will move faster on the 'down' arc, since the same unit of time translates into a longer arc on the 'down' arc compared to the 'up' one - similar approach for the moon). This is handled by the
*((12*60*60)/[Suntime]) and similar parts in the formulas
- the code doesn't care about the previous or the next moon or sun rise and set times, as the movement is done on the basis of current rise and set times; therefore, it's possible that a small "jump" is made at the time of updating with the values for the next day. Given the fact that these differences are generally not that big (a couple of minutes for the sun, roughly 50 minutes for the moon) compared to the full arcs, I rated this as acceptable in the interest of simplicity
Personally, I would have prefered that the 'up' and 'down' arcs are proportional in length with the actual suntime and moontime - it would have simplified the
[SinceSunrise] and
[SinceMoonrise] formulas a bit while slightly complicating the
StartAngle and
RotationAngle formulas when placing them vertically symmetrical, I even set the latter appropriately for a moment when editing the code - but it appears that the equal half circles are more popular among folks compared to accurately representing time invervals on the "sundial", and the change is not that hard to make, so it is what it is.
You do not have the required permissions to view the files attached to this post.