aboutsummaryrefslogtreecommitdiff
path: root/lib/core/time.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-03-20 15:55:57 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-03-20 15:55:57 -0700
commite665d9725c4bb02f4c18d16527367f424cb880fa (patch)
treeaed161ee6b338c2bad2312591f746459414ccafa /lib/core/time.nom
parent606fd090002f3d545cbd58440e96624907846f45 (diff)
Auto-updated to 7.0.0 syntax and removed some shims.
Diffstat (limited to 'lib/core/time.nom')
-rw-r--r--lib/core/time.nom17
1 files changed, 9 insertions, 8 deletions
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