Feature: Use real-time "wallclock" timekeeping units (#11341)

This commit is contained in:
Tyler Trahan
2024-01-23 11:36:09 -05:00
committed by GitHub
parent bbdbf9a589
commit fd9e72a7e7
30 changed files with 546 additions and 140 deletions

View File

@@ -377,6 +377,33 @@ void EmitPlural(Buffer *buffer, char *buf, int)
EmitWordList(buffer, words, nw);
}
/**
* Handle the selection of timekeeping units based on the timekeeping setting.
* This uses the string control character {TKM [value if calendar] [value if wallclock]}, e.g. {TKM month minute}.
* @param buffer The output buffer
* @param buf The input buffer
* @param Unused
*/
void EmitTKM(Buffer* buffer, char* buf, int)
{
/* The correct number of words is 2, but we'll check for more in case of typos. */
std::vector<const char *> words(3, nullptr);
/* Parse each string. */
uint nw = 0;
for (nw = 0; nw < 3; nw++) {
words[nw] = ParseWord(&buf);
if (words[nw] == nullptr) break;
}
/* Warn about the wrong number of parameters. */
if (nw != 2) {
StrgenFatal("%s: Invalid number of TKM options. Expecting %d, found %d.", _cur_ident, 2, nw);
}
buffer->AppendUtf8(SCC_TIMEKEEPING_MODE_LIST);
EmitWordList(buffer, words, 2);
}
void EmitGender(Buffer *buffer, char *buf, int)
{