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
9c44f589
Commit
9c44f589
authored
Dec 14, 2011
by
Hisham Muhammad
Browse files
show proper values for very large times
parent
0bb8dba9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Process.c
View file @
9c44f589
...
@@ -312,19 +312,24 @@ static void Process_printTime(RichString* str, unsigned long long t) {
...
@@ -312,19 +312,24 @@ static void Process_printTime(RichString* str, unsigned long long t) {
double
realTime
=
t
*
jiffytime
;
double
realTime
=
t
*
jiffytime
;
int
iRealTime
=
(
int
)
realTime
;
int
iRealTime
=
(
int
)
realTime
;
int
hours
=
iRealTime
/
3600
;
unsigned
long
long
hours
=
iRealTime
/
3600
;
int
minutes
=
(
iRealTime
/
60
)
%
60
;
int
minutes
=
(
iRealTime
/
60
)
%
60
;
int
seconds
=
iRealTime
%
60
;
int
seconds
=
iRealTime
%
60
;
int
hundredths
=
(
realTime
-
iRealTime
)
*
100
;
int
hundredths
=
(
realTime
-
iRealTime
)
*
100
;
char
buffer
[
11
];
char
buffer
[
11
];
if
(
hours
)
{
if
(
hours
>=
100
)
{
snprintf
(
buffer
,
10
,
"%
2dh
"
,
hours
);
snprintf
(
buffer
,
10
,
"%
7lluh
"
,
hours
);
RichString_append
(
str
,
CRT_colors
[
LARGE_NUMBER
],
buffer
);
RichString_append
(
str
,
CRT_colors
[
LARGE_NUMBER
],
buffer
);
snprintf
(
buffer
,
10
,
"%02d:%02d "
,
minutes
,
seconds
);
}
else
{
}
else
{
snprintf
(
buffer
,
10
,
"%2d:%02d.%02d "
,
minutes
,
seconds
,
hundredths
);
if
(
hours
)
{
snprintf
(
buffer
,
10
,
"%2lluh"
,
hours
);
RichString_append
(
str
,
CRT_colors
[
LARGE_NUMBER
],
buffer
);
snprintf
(
buffer
,
10
,
"%02d:%02d "
,
minutes
,
seconds
);
}
else
{
snprintf
(
buffer
,
10
,
"%2d:%02d.%02d "
,
minutes
,
seconds
,
hundredths
);
}
RichString_append
(
str
,
CRT_colors
[
DEFAULT_COLOR
],
buffer
);
}
}
RichString_append
(
str
,
CRT_colors
[
DEFAULT_COLOR
],
buffer
);
}
}
static
inline
void
Process_writeCommand
(
Process
*
this
,
int
attr
,
int
baseattr
,
RichString
*
str
)
{
static
inline
void
Process_writeCommand
(
Process
*
this
,
int
attr
,
int
baseattr
,
RichString
*
str
)
{
...
...
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