Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
385a7dbe
Commit
385a7dbe
authored
Mar 11, 2009
by
Hisham Muhammad
Browse files
simplify uptime calculation
parent
3b950e41
Changes
1
Hide whitespace changes
Inline
Side-by-side
UptimeMeter.c
View file @
385a7dbe
...
...
@@ -25,9 +25,9 @@ static void UptimeMeter_setValues(Meter* this, char* buffer, int len) {
fclose
(
fd
);
int
totalseconds
=
(
int
)
ceil
(
uptime
);
int
seconds
=
totalseconds
%
60
;
int
minutes
=
(
totalseconds
-
seconds
)
%
3600
/
60
;
int
hours
=
(
totalseconds
-
seconds
-
(
minutes
*
60
)
)
%
86400
/
3600
;
int
days
=
(
totalseconds
-
seconds
-
(
minutes
*
60
)
-
(
hours
*
3600
))
/
86400
;
int
minutes
=
(
totalseconds
/
60
)
%
60
;
int
hours
=
(
totalseconds
/
3
60
0
)
%
24
;
int
days
=
(
totalseconds
/
86400
)
;
this
->
values
[
0
]
=
days
;
if
(
days
>
this
->
total
)
{
this
->
total
=
days
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment