mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
LinuxProcess_adjustTime: simplify by not using double
Does not work with -ffast-math else.
This commit is contained in:
parent
95f553b10c
commit
42c842c190
@ -292,18 +292,16 @@ void ProcessList_delete(ProcessList* pl) {
|
||||
}
|
||||
|
||||
static inline unsigned long long LinuxProcess_adjustTime(unsigned long long t) {
|
||||
static double jiffy = NAN;
|
||||
if (isnan(jiffy)) {
|
||||
static long jiffy = -1;
|
||||
if (jiffy == -1) {
|
||||
errno = 0;
|
||||
long sc_jiffy = sysconf(_SC_CLK_TCK);
|
||||
if (errno || -1 == sc_jiffy) {
|
||||
jiffy = NAN;
|
||||
jiffy = sysconf(_SC_CLK_TCK);
|
||||
if (errno || -1 == jiffy) {
|
||||
jiffy = -1;
|
||||
return t; // Assume 100Hz clock
|
||||
}
|
||||
jiffy = sc_jiffy;
|
||||
}
|
||||
double jiffytime = 1.0 / jiffy;
|
||||
return t * jiffytime * 100;
|
||||
return t * 100 / jiffy;
|
||||
}
|
||||
|
||||
static bool LinuxProcessList_readStatFile(Process* process, const char* dirname, const char* name, char* command, int* commLen) {
|
||||
|
Loading…
Reference in New Issue
Block a user