Post by Ike on Jul 24, 2005 17:01:44 GMT -5
It's a bit sloppy. I didn't bother implementing days of the week, although I could have easily, and the input is rather slipshod in my opinion.
The next step for me I guess would be to create an openGL interface, maybe an image of an analog clock too.
The next step for me I guess would be to create an openGL interface, maybe an image of an analog clock too.
dim hour, minute, second, pm, day, month, ly, year
'VARIABLE INPUT
print "year?:" : year = val(input$ ())
print "leap year in?:" : ly = val(input$ ())
print "month?: " : month = val(input$ ())
print "day?: " : day = val(input$ ())
print "pm?: " : pm = val(input$ ())
print "hour?: " : hour = val(input$ ())
print "minute?: " : hour = val(input$ ())
print "second?: " : hour = val(input$ ())
while true
textmode(text_buffered)
drawtext()
cls
color (255, 255, 255)
sleep(1000)
'HOUR DISPLAY
print "00:"
if len(hour) = 2 then
locate 0, 0 : print hour
else
locate 1, 0 : print hour
endif
'END
'MINUTE DISPLAY
locate 3, 0 : print "00:"
if len(minute) = 2 then
locate 3, 0 : print minute
else
locate 4, 0 : print minute
endif
'END
'SECOND DISPLAY
locate 6, 0 : print "00"
if len(second) = 2 then
locate 6, 0 : print second
else
locate 7, 0 : print second
endif
'END
'AM/PM DISPLAY
if pm = 0 then
locate 9, 0 : print "AM"
else
locate 9, 0 : print "PM"
endif
'END
'MONTH DISPLAY
locate 0, 1 : print "00/"
if len(month) = 2 then
locate 0, 1 : print month
else
locate 1, 1 : print month
endif
'END
'DAY DISPLAY
locate 3, 1 : print "00/"
if len(day) = 2 then
locate 3, 1 : print day
else
locate 4, 1 : print day
endif
'END
'YEAR DISPLAY
locate 6, 1 : print "00"
if len(year) = 2 then
locate 6, 1 : print year
else
locate 7, 1 : print year
endif
locate 0, 3 : print "Years until next leap year: " : print ly
'END
'CLOCK MECHANICS
second = second + 1
if second > 59 then
second = 0
minute = minute + 1
endif
if minute > 59 then
minute = 0
hour = hour + 1
endif
if hour = 12 and pm = false then
hour = 0
pm = 1
endif
if hour = 12 and pm = true then
hour = 0
pm = 0
day = day + 1
endif
if ly < 4 then
if day > 28 and month = 2 then
day = 1
month = 3
endif
else
if day > 29 and month = 2 then
day = 1
month = 3
endif
endif
if day > 31 and (month = 4 or month = 6 or month = 9 or month = 11) then
day = 1
month = month + 1
endif
if day > 31 and (month = 1 or month = 3 or month = 5 or month = 7 or month = 8 or month = 10) then
day = 1
month = month + 1
endif
if day > 31 and month = 12 then
day = 1
month = 1
ly = ly + 1
year = year + 1
endif
if ly > 3 then
ly = 0
endif
if year > 99 then
year = 0
endif
'END
wend