#include <xinu.h>
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
◆ xsh_uptime()
shellcmd xsh_uptime |
( |
int |
nargs, |
|
|
char * |
args[] |
|
) |
| |
Definition at line 11 of file xsh_uptime.c.
References clktime, fprintf(), printf(), stderr, and strncmp().
13 uint32 days, hrs, mins, secs;
21 if (nargs == 2 &&
strncmp(args[1],
"--help", 7) == 0) {
22 printf(
"Use: %s\n\n", args[0]);
24 printf(
"\tDisplays time since the system booted\n");
26 printf(
"\t--help\t display this help and exit\n");
43 days = secs/secperday;
44 secs -= days*secperday;
53 mins = secs/secpermin;
54 secs -= mins*secpermin;
56 printf(
"Xinu has been up ");
58 printf(
" %d day(s) ", days);
62 printf(
" %d hour(s) ", hrs);
66 printf(
" %d minute(s) ", mins);
70 printf(
" %d second(s) ", secs);
int32 strncmp(const char *, const char *, int32)
int32 printf(const char *,...)
int32 fprintf(int, char *,...)
uint32 clktime
起動してからの現在の時間[s]
unsigned int uint32
符号なし32ビット整数(unsigned int)