Skip to content

Commit

Permalink
Lab util: uptime
Browse files Browse the repository at this point in the history
  • Loading branch information
foyoodo committed Mar 8, 2021
1 parent a1ceb89 commit 0318941
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ UPROGS=\
$U/_sh\
$U/_sleep\
$U/_stressfs\
$U/_uptime\
$U/_usertests\
$U/_grind\
$U/_wc\
Expand Down
16 changes: 16 additions & 0 deletions user/uptime.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "kernel/types.h"
#include "user/user.h"

int
main(int argc, char *argv[])
{

if (argc > 1) {
fprintf(2, "Usage: uptime\n");
exit(1);
}

fprintf(1, "%d ticks\n", uptime());

exit(0);
}

0 comments on commit 0318941

Please sign in to comment.