about summary refs log tree commit diff stats
path: root/402time.mu
diff options
context:
space:
mode:
Diffstat (limited to '402time.mu')
-rw-r--r--402time.mu12
1 files changed, 8 insertions, 4 deletions
diff --git a/402time.mu b/402time.mu
index c95c4e14..5407b6b7 100644
--- a/402time.mu
+++ b/402time.mu
@@ -3,23 +3,27 @@ type timespec {
   tv_nsec: int
 }
 
+# return time in seconds since epoch
 # TODO: y2038
-fn time -> secs/eax: int {
+fn time -> _/eax: int {
   var t: timespec
   var clock/ebx: int <- copy 0  # CLOCK_MONOTONIC
   var t-addr/ecx: (addr timespec) <- address t
   syscall_clock_gettime
   var t-secs-addr/ecx: (addr int) <- get t-addr, tv_sec
-  secs <- copy *t-secs-addr
+  var secs/eax: int <- copy *t-secs-addr
+  return secs
 }
 
-fn ntime -> nsecs/eax: int {
+# return time in nanoseconds since epoch
+fn ntime -> _/eax: int {
   var t: timespec
   var clock/ebx: int <- copy 0  # CLOCK_MONOTONIC
   var t-addr/ecx: (addr timespec) <- address t
   syscall_clock_gettime
   var t-nsecs-addr/ecx: (addr int) <- get t-addr, tv_nsec
-  nsecs <- copy *t-nsecs-addr
+  var nsecs/eax: int <- copy *t-nsecs-addr
+  return nsecs
 }
 
 # nsecs must be less than 999999999 or 0x3b9ac9ff nanoseconds