mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 10:52:08 +02:00
e0eba8ce21
```bash find . -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) ! -path "src/3rdparty/*" -print0 | xargs -0 clang-format -i ```
27 lines
745 B
C
27 lines
745 B
C
#include "common/frequency.h"
|
|
|
|
bool ffFreqAppendNum(uint32_t mhz, FFstrbuf* result) {
|
|
if (mhz == 0) {
|
|
return false;
|
|
}
|
|
|
|
const FFOptionsDisplay* options = &instance.config.display;
|
|
bool spaceBeforeUnit = options->freqSpaceBeforeUnit != FF_SPACE_BEFORE_UNIT_NEVER;
|
|
int8_t ndigits = options->freqNdigits;
|
|
|
|
if (ndigits >= 0) {
|
|
ffStrbufAppendDouble(result, mhz / 1000., ndigits, true);
|
|
if (spaceBeforeUnit) {
|
|
ffStrbufAppendC(result, ' ');
|
|
}
|
|
ffStrbufAppendS(result, "GHz");
|
|
} else {
|
|
ffStrbufAppendUInt(result, mhz);
|
|
if (spaceBeforeUnit) {
|
|
ffStrbufAppendC(result, ' ');
|
|
}
|
|
ffStrbufAppendS(result, "MHz");
|
|
}
|
|
return true;
|
|
}
|