Index: src/conky.c =================================================================== RCS file: /cvsroot/conky/conky/src/conky.c,v retrieving revision 1.6 diff -u -r1.6 conky.c --- src/conky.c 24 Aug 2005 06:29:53 -0000 1.6 +++ src/conky.c 24 Aug 2005 06:47:21 -0000 @@ -1615,10 +1615,10 @@ i)+ 40) * 9.0 / 5 - 40)); } OBJ(freq) { - snprintf(p, n, "%sMhz", get_freq()); + snprintf(p, n, "%.0fMhz", get_freq()); } OBJ(freq_g) { - float ghz = (float)(atof(get_freq())/1000); + float ghz = (float)(get_freq()/1000); //printf("%f\n", ghz); snprintf(p, n, "%'.2fGhz", ghz); } Index: src/conky.h =================================================================== RCS file: /cvsroot/conky/conky/src/conky.h,v retrieving revision 1.2 diff -u -r1.2 conky.h --- src/conky.h 23 Aug 2005 06:10:25 -0000 1.2 +++ src/conky.h 24 Aug 2005 06:47:24 -0000 @@ -266,7 +266,7 @@ void update_cpu_usage(void); void update_total_processes(void); void update_running_processes(void); -char *get_freq(); +float get_freq(); void update_load_average(); int open_i2c_sensor(const char *dev, const char *type, int n, int *div, char *devtype); Index: src/freebsd.c =================================================================== RCS file: /cvsroot/conky/conky/src/freebsd.c,v retrieving revision 1.3 diff -u -r1.3 freebsd.c --- src/freebsd.c 24 Aug 2005 05:33:10 -0000 1.3 +++ src/freebsd.c 24 Aug 2005 06:47:24 -0000 @@ -421,39 +421,27 @@ return ""; } -char *get_freq() +float get_freq() { /* First, try to obtain CPU frequency via dev.cpu.0.freq sysctl * (cpufreq(4)). If failed, do i386 magic. */ int freq; - char *cpuspeed; - - if ((cpuspeed = malloc(8)) == NULL) - CRIT_ERR("get_freq()"); - if (GETSYSCTL("dev.cpu.0.freq", freq) == 0) { - snprintf(cpuspeed, 8, "%d", freq); - return cpuspeed; - } -#if defined(i386) || defined(__i386__) + if (GETSYSCTL("dev.cpu.0.freq", freq) == 0) + return (float)freq; else { +#if defined(i386) || defined(__i386__) int i; i = 0; if ((i = get_cpu_speed()) > 0) { - if (i < 1000000) { - i += 50; /* for rounding */ - snprintf(cpuspeed, 8, "%d.%d", i / 1000, - (i / 100) % 10); - } else - snprintf(cpuspeed, 8, "%d", i / 1000); + return (float)(i / 1000); } else - cpuspeed = ""; - - return cpuspeed; + return 0; } #else - return ""; + return 0; + } #endif /* i386 */ } Index: src/linux.c =================================================================== RCS file: /cvsroot/conky/conky/src/linux.c,v retrieving revision 1.1 diff -u -r1.1 linux.c --- src/linux.c 21 Aug 2005 22:10:54 -0000 1.1 +++ src/linux.c 24 Aug 2005 06:47:24 -0000 @@ -663,7 +663,7 @@ static char *frequency; #endif -char *get_freq() +float get_freq() { #if defined(__i386) || defined(__x86_64) if (buffer == NULL) @@ -689,7 +689,7 @@ sprintf(buffer, "%lld", (cycles[1] - cycles[0]) / microseconds); - return buffer; + return strtod(buffer, (char **)NULL); #else FILE *f; char s[1000]; @@ -711,7 +711,7 @@ } fclose(f); //printf("%s\n", frequency); - return frequency; + return strtod(frequency, (char **)NULL); #endif }