ref: 543467de958b3083b7d133fec211f22dbdd2ef33
parent: f84e82b374d82b1668968095fe45417ba11d78fe
author: Ori Bernstein <[email protected]>
date: Sat Aug 23 21:52:25 EDT 2014
Initialize the time in std.now() ...It was returning junk. Argh.
--- a/6/isel.c
+++ b/6/isel.c
@@ -1194,8 +1194,8 @@
is.curbb = is.bb[j];
for (i = 0; i < fn->cfg->bb[j]->nnl; i++) {
/* put in a comment that says where this line comes from */
- snprintf(buf, sizeof buf, "\n\t# bb = %zd, bbidx = %zd, line=%d",
- j, i, fn->cfg->bb[j]->nl[i]->line);
+ snprintf(buf, sizeof buf, "\n\t# bb = %zd, bbidx = %zd, %s:%d",
+ j, i, file->file.name, fn->cfg->bb[j]->nl[i]->line);
g(&is, Ilbl, locstrlbl(buf), NULL);
isel(&is, fn->cfg->bb[j]->nl[i]);
}
--- a/libstd/now.myr
+++ b/libstd/now.myr
@@ -11,10 +11,10 @@
var tm
var sec
var nsec
-
- sec = tm.sec
- nsec = tm.nsec castto(uint64)
- if clock_gettime(`Clockrealtime, &tm) == 0
+
+ if clock_gettime(`Clockrealtime, &tm) == 0
+ sec = tm.sec
+ nsec = tm.nsec castto(uint64)
-> (sec*1000 + nsec/(1000*1000)) castto(time)
else
-> -1