I'm trying to get the Julian date for Astronomy to display, not sure if I did it correctly or if there is a better way.
Time.ini
Code: Select all
[Rainmeter]
Update=1000
[Metadata]
Author=CyberTheWorm
Version=1.0.0
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Information=Julian Date Test
;-------------------- Variables ----------------------
[Variables]
MyFontSize=15
MyFontColor=255,255,255,255
MyEffect=Shadow
MyEffectColor=0,0,0,255
;-------------------- Measures ----------------------------
[MeasureTime]
Measure=Time
Format=%T, %Z
[MeasureJDScript]
Measure=Script
ScriptFile=Julian.lua
Disabled=1
;--------------------- Meters --------------------------------
[MeterTime]
Meter=String
MeasureName=MeasureTime
AntiAlias=1
FontFace=#MyFont#
FontSize=#MyFontSize#
FontColor=#MyFontColor#
StringEffect=#MyEffect#
FontEffectColor=#MyEffectColor#
Text=%1
[MeterJD]
Meter=String
AntiAlias=1
Y=20
FontFace=#MyFont#
FontSize=#MyFontSize#
FontColor=#MyFontColor#
StringEffect=#MyEffect#
FontEffectColor=#MyEffectColor#
Text=Julian Date: [&MeasureJDScript:GetJulian()]
DynamicVariables=1
Code: Select all
function GetJulian()
Year = tonumber(os.date('%Y'))
Month = tonumber(os.date('%m'))
Day = tonumber(os.date('%e'))
Hour = tonumber(os.date('%H'))
Min = tonumber(os.date('%M'))
Sec = tonumber(os.date('%S'))
JDN = (1461 * (Year + 4800 + (Month - 14)/12))/4 +(367 * (Month - 2 - 12 * ((Month - 14)/12)))/12 - (3 * ((Year + 4900 + (Month - 14)/12)/100))/4 + Day - 32075
JD = JDN + (Hour -12)/24 + Min/1440 + Sec/86400
return JD
end