1
0
Fork 0
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:
Stefan Lankes 2016-10-09 23:14:31 +02:00
parent add938ae38
commit cec424f369

View file

@ -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);