Skip to content

Instantly share code, notes, and snippets.

@TwoTau
Created August 4, 2018 00:18
Show Gist options
  • Save TwoTau/debbe79abe59c6daae71682444bee1a7 to your computer and use it in GitHub Desktop.
Save TwoTau/debbe79abe59c6daae71682444bee1a7 to your computer and use it in GitHub Desktop.
Simple Rainmeter binary clock that shows the number of seconds elapsed from the beginning of the year.
[Rainmeter]
Update=1000
[Metadata]
Name=BinaryTime
Author=Vishal Devireddy
Information=The number of seconds from the beginning of the year in binary.
[Variables]
Radius=10
Spacing=5
FullColor=50,50,250,200
EmptyColor=140,140,140,100
[CircleStyle]
W=(#Radius#*2+#Spacing#)
H=(#Radius#*2+#Spacing#)
X=R
Y=0
LineLength=#Radius#
LineColor=#FullColor#
Solid=1
AntiAlias=1
[mDayOfYear]
Measure=Time
Format=%j
; The day of the year, from 1-366 inclusive
[mHours]
Measure=Time
Format=%H
; The hour, from 0-23 inclusive
[mMinutes]
Measure=Time
Format=%M
; The minute, from 0-59 inclusive
[mSeconds]
Measure=Time
Format=%S
; The second, from 0-59 inclusive
[mFinalDecimalCalc]
Measure=Calc
Formula=(mDayOfYear - 1)*24*60*60+mHours*60*60+mMinutes*60+mSeconds
; Calculates the seconds since the beginning of the year, in base 10
[mLua]
Measure=Script
ScriptFile=line.lua
[m1]
Meter=Roundline
MeterStyle=CircleStyle
X=0
[m2]
Meter=Roundline
MeterStyle=CircleStyle
[m3]
Meter=Roundline
MeterStyle=CircleStyle
[m4]
Meter=Roundline
MeterStyle=CircleStyle
[m5]
Meter=Roundline
MeterStyle=CircleStyle
[m6]
Meter=Roundline
MeterStyle=CircleStyle
[m7]
Meter=Roundline
MeterStyle=CircleStyle
[m8]
Meter=Roundline
MeterStyle=CircleStyle
[m9]
Meter=Roundline
MeterStyle=CircleStyle
[m10]
Meter=Roundline
MeterStyle=CircleStyle
[m11]
Meter=Roundline
MeterStyle=CircleStyle
[m12]
Meter=Roundline
MeterStyle=CircleStyle
[m13]
Meter=Roundline
MeterStyle=CircleStyle
[m14]
Meter=Roundline
MeterStyle=CircleStyle
[m15]
Meter=Roundline
MeterStyle=CircleStyle
[m16]
Meter=Roundline
MeterStyle=CircleStyle
[m17]
Meter=Roundline
MeterStyle=CircleStyle
[m18]
Meter=Roundline
MeterStyle=CircleStyle
[m19]
Meter=Roundline
MeterStyle=CircleStyle
[m20]
Meter=Roundline
MeterStyle=CircleStyle
[m21]
Meter=Roundline
MeterStyle=CircleStyle
[m22]
Meter=Roundline
MeterStyle=CircleStyle
[m23]
Meter=Roundline
MeterStyle=CircleStyle
[m24]
Meter=Roundline
MeterStyle=CircleStyle
[m25]
Meter=Roundline
MeterStyle=CircleStyle
function Initialize()
mDecimalTime = SKIN:GetMeasure("mFinalDecimalCalc")
end
function Update()
decimalTime = mDecimalTime:GetValue()
for i = 24, 0, -1 do
if decimalTime - 2^i > 0 then
decimalTime = decimalTime - 2^i
SKIN:Bang("!SetOption m"..(25-i).." LineColor #FullColor#")
else
SKIN:Bang("!SetOption m"..(25-i).." LineColor #EmptyColor#")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment