mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
round frequency to an integer
This commit is contained in:
parent
add938ae38
commit
cec424f369
1 changed files with 6 additions and 1 deletions
|
@ -106,7 +106,8 @@ static void exit_handler(int sig)
|
|||
static char* cpufreq(void)
|
||||
{
|
||||
char line[2048];
|
||||
const char* match = NULL;
|
||||
char* match;
|
||||
char* point;
|
||||
|
||||
FILE* fp = fopen("/proc/cpuinfo", "r");
|
||||
if (!fp)
|
||||
|
@ -120,6 +121,10 @@ static char* cpufreq(void)
|
|||
for(; (*match < 0x30) || (*match > 0x39); match++)
|
||||
;
|
||||
|
||||
for(point = match; ((*point != '.') && (*point != '\0')); point++)
|
||||
;
|
||||
*point = '\0';
|
||||
|
||||
snprintf(cmdline, MAX_PATH, "-freq%s", match);
|
||||
fclose(fp);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue