isbpl/time.isbpl

47 lines
709 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 {
2022-05-18 16:43:05 +02:00
with this ;
getms this =startMS
null this =timeTakenTMP
2022-05-13 19:12:03 +02:00
}
2022-05-18 16:43:05 +02:00
end {
with this ;
getms this =stopMS
null this =timeTakenTMP
2022-05-13 19:12:03 +02:00
}
timeTaken {
2022-05-18 16:43:05 +02:00
with this ;
this timeTakenTMP null eq not if {
this timeTakenTMP 2 stop
2022-05-13 19:12:03 +02:00
}
2022-05-18 16:43:05 +02:00
this startMS this stopMS eq if {
0 dup this =timeTakenTMP
2022-05-13 19:12:03 +02:00
2 stop
}
2022-05-18 16:43:05 +02:00
this stopMS this startMS - dup this =timeTakenTMP
2022-05-13 19:12:03 +02:00
}
} =Timer