Xinqi Bao's Git
projects
/
slstatus.git
/ blob
summary
|
log
|
commit
|
diff
|
tree
history
|
raw
|
HEAD
Print unknown_str in case of error
[slstatus.git]
/
components
/
uptime.c
1
/* See LICENSE file for copyright and license details. */
2
#include <sys/sysinfo.h>
3
4
#include
"../util.h"
5
6
const char
*
7
uptime
(
void
)
8
{
9
struct
sysinfo info
;
10
int
h
=
0
;
11
int
m
=
0
;
12
13
sysinfo
(&
info
);
14
h
=
info
.
uptime
/
3600
;
15
m
= (
info
.
uptime
-
h
*
3600
) /
60
;
16
17
return
bprintf
(
"%dh %dm"
,
h
,
m
);
18
}