ref: 14783b2038a2a9e92df26adaa12a9d2a4c1301f9
parent: f884639b36e11d69b96e5a269085ca12cc1e3807
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