shithub: mc

Download patch

ref: fce00d2eea950d46cab89b42b9cf729e7b1db459
parent: 2d5321bb2fa2e34fce928bfef653776aba2c39d3
author: Ori Bernstein <[email protected]>
date: Thu Aug 28 08:24:22 EDT 2014

Switch now from milliseconds microseconds.

--- a/libstd/now.myr
+++ b/libstd/now.myr
@@ -6,7 +6,7 @@
 	const now	: (-> time)
 ;;
 
-/* milliseconds since epoch */
+/* microseconds since epoch */
 const now = {
 	var tm
 	var sec
@@ -15,7 +15,7 @@
 	if clock_gettime(`Clockrealtime, &tm) == 0	
 		sec = tm.sec
 		nsec = tm.nsec castto(uint64)
-		-> (sec*1000 + nsec/(1000*1000)) castto(time)
+		-> (sec*1_000_000 + nsec/1000) castto(time)
 	else
 		-> -1
 	;;
--- a/libstd/test.myr
+++ b/libstd/test.myr
@@ -19,7 +19,7 @@
 	var a
 	var buf
 
-	std.put("The time is %l seconds past the epoch\n", std.now()/1000);
+	std.put("The time is %l seconds past the epoch\n", std.now()/1_000_000);
 	std.uname(&buf)
 	std.put("And you are running on:\n")
 	std.put("\tsystem:\t\"%s\"\n", ntstr(buf.system[:]))