Skip to content

Commit

Permalink
Add time command
Browse files Browse the repository at this point in the history
  • Loading branch information
bill88t committed Feb 27, 2024
1 parent a117ace commit ca025e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Beryllium/bin/time.lja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fpexec /bin/time.py
9 changes: 9 additions & 0 deletions Beryllium/bin/time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rename_process("time")
vr("cmd", be.based.user_vars["argj"].split()[1:])
vr("sttime", time.monotonic())
be.based.run(" ".join(vr("cmd")))
vr("time", time.monotonic() - vr("sttime"))
vr("m", int(vr("time") / 60))
vr("tmf", str(vr("m")) + "m" + str(vr("time") - (vr("m") * 60)) + "s")
be.api.setvar("return", str(vr("tmf")))
term.write("\nreal " + be.api.getvar("return"))

0 comments on commit ca025e7

Please sign in to comment.