mirror of https://github.com/xzeldon/htop.git
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 inline unsigned long long LinuxProcess_adjustTime(unsigned long long t) {
|
||||||
static double jiffy = NAN;
|
static long jiffy = -1;
|
||||||
if (isnan(jiffy)) {
|
if (jiffy == -1) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
long sc_jiffy = sysconf(_SC_CLK_TCK);
|
jiffy = sysconf(_SC_CLK_TCK);
|
||||||
if (errno || -1 == sc_jiffy) {
|
if (errno || -1 == jiffy) {
|
||||||
jiffy = NAN;
|
jiffy = -1;
|
||||||
return t; // Assume 100Hz clock
|
return t; // Assume 100Hz clock
|
||||||
}
|
}
|
||||||
jiffy = sc_jiffy;
|
|
||||||
}
|
}
|
||||||
double jiffytime = 1.0 / jiffy;
|
return t * 100 / jiffy;
|
||||||
return t * jiffytime * 100;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool LinuxProcessList_readStatFile(Process* process, const char* dirname, const char* name, char* command, int* commLen) {
|
static bool LinuxProcessList_readStatFile(Process* process, const char* dirname, const char* name, char* command, int* commLen) {
|
||||||
|
|
Loading…
Reference in New Issue