From 75409605654640b716003d8fd44e7899d251e4a6 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Fri, 13 May 2022 19:12:03 +0200 Subject: [PATCH] Added timer --- time.isbpl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/time.isbpl b/time.isbpl index 3b30a28..b50d6ee 100644 --- a/time.isbpl +++ b/time.isbpl @@ -15,3 +15,29 @@ func delay { func delays { 1000 * time pop } + +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