From e665d9725c4bb02f4c18d16527367f424cb880fa Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 20 Mar 2019 15:55:57 -0700 Subject: Auto-updated to 7.0.0 syntax and removed some shims. --- lib/core/time.nom | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/core/time.nom') diff --git a/lib/core/time.nom b/lib/core/time.nom index 63ff594..0a82fa5 100644 --- a/lib/core/time.nom +++ b/lib/core/time.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines time-related actions. use "core/metaprogramming" @@ -14,23 +15,23 @@ external: (a Time) is (a thing) with [ $year, $month, $day, $hour, $min, $sec, $wday, $yday, $isdst ]: - ($self, + $other) means: + ($self, +$other) means: if (($self is "a Time") and ($other is "a Time")): fail (" Type error: Cannot add two times together. Hint: One of these two should be a number, not a time. ") - if ($other is not "a Number"): + if ($other isn'tt "a Number"): $other = ($os.time $other) - if ($self is not "a Number"): + if ($self isn't "a Number"): $self = ($os.time $self) return (a Time ($os.date "*t" ($self + $other, rounded))) - ($self, - $other) means: - if ($self is not "a Time"): + ($self, -$other) means: + if ($self isn't "a Time"): fail "Type error: Cannot subtract a Time from something that isn't a Time." $self = ($os.time $self) if ($other is "a Time"): @@ -45,7 +46,7 @@ external: return (a Time ($os.date "*t")) [sleep for $t seconds, sleep for $t second] all mean: - # Lua does not come with a sleep() function, only an os.clock() function, + ### Lua does not come with a sleep() function, only an os.clock() function, so this busy-loop is necessary for cross-platform compatibility. $deadline = (($os.clock()) + $t) repeat while (($os.clock()) < $deadline): do nothing -- cgit v1.2.3