mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:14:37 +02:00
a0174e8666
1. `--<module>-space-before-unit` 2. `--duration-abbreviation` 3. various code refactoring and cleanups
18 lines
515 B
C
18 lines
515 B
C
#include "frequency.h"
|
|
|
|
bool ffFreqAppendNum(uint32_t mhz, FFstrbuf* result)
|
|
{
|
|
if (mhz == 0)
|
|
return false;
|
|
|
|
const FFOptionsDisplay* options = &instance.config.display;
|
|
const char* space = options->freqSpaceBeforeUnit == FF_SPACE_BEFORE_UNIT_NEVER ? "" : " ";
|
|
int8_t ndigits = options->freqNdigits;
|
|
|
|
if (ndigits >= 0)
|
|
ffStrbufAppendF(result, "%.*f%sGHz", ndigits, mhz / 1000., space);
|
|
else
|
|
ffStrbufAppendF(result, "%u%sMHz", (unsigned) mhz, space);
|
|
return true;
|
|
}
|