Code: Select all
[indent=2]
def getTime() : string
return GLib.Time.local(time_t ()).to_string()
init
//-- display the current time --
print ("%s" , getTime())
//-- run a timer to check how long a code needs --
timer : Timer = new Timer()
timer.start()
for var n = 0 to 10000
print ("%d" , n)
timer.stop()
print ("%f seconds were needed." , timer.elapsed() )
Vala should support multithreaded programming, but you must explicitly create such threads.
The above example does not use threads, just a "for" loop, to print some values.
The timer checks, how long it takes to print them.
And now eat some fish *mjam
Mark