A.14 Time and date

XLOGO has several primitives for date, time or generating countdown.

wait n


Halts the program, and therefore the turtle, for 6n0 seconds.

countdown n


Starts a countdown of n seconds. We know if this countdown has finished with the primitive endcountdown?

endcountdown?


Returns "true if there’s no active countdown. Returns "false if the countdown is active.

date


Returns a list wich contains three integers representing the date. The first integer indicates the day, the second the month and the last the year. —> [day month year]

time


Returns a list of three integers representing the time. The first integer indicates the hour, the second the minutes and the last the seconds. —> [hour minute seconde]

pasttime


Returns the past time in seconds since XLOGOhas started.

Difference between wait and countdown is that countdown doesn’t halt the program.

Here is an example:
to clock  
# shows time in numerical format  
# we refresh the time each five seconds  
if endcountdown? [  
cs  
sfont 75 ht  
make "heu time  
make "h first :heu  
make "m item 2 :heu  
# We shows two number for seconds and minutes. (we must add a 0)  
if :m-10<0 [make "m word 0 :m]  
make "s last :heu  
# We shows two number for seconds and minutes. (we must add a 0)  
if :s-10<0 [make "s word 0 :s]  
label word word word word :h ": :m ": :s  
countdown 5  
]  
clock  
end