isbpl/time.isbpl

44 lines
578 B
Text
Raw Normal View History

native time
func getms {
0 time
}
func sleep {
time pop
}
func delay {
time pop
}
func delays {
1000 * time pop
}
2022-05-13 19:12:03 +02:00
def Timer
construct Timer {
startMS
stopMS
timeTakenTMP
;
start {
getms =startMS
null =timeTakenTMP
}
stop {
getms =stopMS
null =timeTakenTMP
}
timeTaken {
timeTakenTMP if {
timeTakenTMP 2 stop
}
startMS stopMS eq if {
0 dup =timeTakenTMP
2 stop
}
stopMS startMS - dup =timeTakenTMP
}
} =Timer