diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index 10a5c4c7..f70e4ba7 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -541,8 +541,13 @@ B list_c1(B d, B x) { B unixTime_c1(B t, B x) { dec(x); - B r = m_i32(time(NULL)); - return r; + return m_i32(time(NULL)); +} +B monoTime_c1(B t, B x) { + dec(x); + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return m_i32(ts.tv_sec); } B delay_c1(B t, B x) { f64 sf = o2f(x); @@ -686,6 +691,7 @@ B sys_c1(B t, B x) { else if (eqStr(c, U"bqn")) r.a[i] = inc(bi_bqn); else if (eqStr(c, U"cmp")) r.a[i] = inc(bi_cmp); else if (eqStr(c, U"unixtime")) r.a[i] = inc(bi_unixTime); + else if (eqStr(c, U"monotime")) r.a[i] = inc(bi_monoTime); else if (eqStr(c, U"timed")) r.a[i] = inc(bi_timed); else if (eqStr(c, U"delay")) r.a[i] = inc(bi_delay); else if (eqStr(c, U"hash")) r.a[i] = inc(bi_hash); diff --git a/src/utils/builtins.h b/src/utils/builtins.h index 37635a6e..e978163b 100644 --- a/src/utils/builtins.h +++ b/src/utils/builtins.h @@ -9,7 +9,7 @@ /* everything before the definition of •Type is defined to be pure, and everything after is not */ \ /* sysfn.c*/M(type,"•Type") M(decp,"•Decompose") M(primInd,"•PrimInd") M(glyph,"•Glyph") A(fill,"•FillFn") M(sys,"•getsys") A(grLen,"•GroupLen") D(grOrd,"•groupOrd") \ /* sysfn.c*/M(repr,"•Repr") M(fmt,"•Fmt") A(asrt,"!") A(casrt,"!") M(out,"•Out") M(show,"•Show") M(bqn,"•BQN") M(sh,"•SH") M(fromUtf8,"•FromUTF8") \ -/* sysfn.c*/D(cmp,"•Cmp") A(hash,"•Hash") M(unixTime,"•UnixTime") M(delay,"•Delay") M(makeRand,"•MakeRand") M(reBQN,"•ReBQN") M(exit,"•Exit") M(getLine,"•GetLine") \ +/* sysfn.c*/D(cmp,"•Cmp") A(hash,"•Hash") M(unixTime,"•UnixTime") M(monoTime,"•MonoTime") M(delay,"•Delay") M(makeRand,"•MakeRand") M(reBQN,"•ReBQN") M(exit,"•Exit") M(getLine,"•GetLine") \ /*internal.c*/M(itype,"•internal.Type") M(refc,"•internal.Refc") M(squeeze,"•internal.Squeeze") M(isPure,"•internal.IsPure") A(info,"•internal.Info") \ /*internal.c*/D(variation,"•internal.Variation") A(listVariations,"•internal.ListVariations") M(clearRefs,"•internal.ClearRefs") M(unshare,"•internal.Unshare")