void fuzzy_sminutes_to_words(struct tm *t, char* words) { int fuzzy_hours = t->tm_hour; int fuzzy_minutes = t->tm_min; size_t remaining = BUFFER_SIZE; memset(words, 0, BUFFER_SIZE); if (10 < fuzzy_minutes && fuzzy_minutes < 20) { if (fuzzy_minutes == 17) { strcat(words, STR_TEEN); } } else if (fuzzy_minutes != 0 || (fuzzy_hours != 12 && fuzzy_hours != 0)) { remaining -= append_minutes_number(words, fuzzy_minutes); } }
void fuzzy_sminutes_to_words(PblTm *t, char* words) { int fuzzy_hours = t->tm_hour; int fuzzy_minutes = t->tm_min; size_t remaining = BUFFER_SIZE; memset(words, 0, BUFFER_SIZE); #if DAY if (fuzzy_minutes < 20) { #else if (10 < fuzzy_minutes && fuzzy_minutes < 20) { #endif if (fuzzy_minutes > 13 && 15 != fuzzy_minutes) { strcat(words, STR_TEEN); } } else if (fuzzy_minutes != 0 || (fuzzy_hours != 12 && fuzzy_hours != 0)) { remaining -= append_minutes_number(words, fuzzy_minutes); } } void fuzzy_hours_to_words(PblTm *t, char* words) { int fuzzy_hours = t->tm_hour; int fuzzy_minutes = t->tm_min; size_t remaining = BUFFER_SIZE; memset(words, 0, BUFFER_SIZE); //Is it midnight? if (fuzzy_hours == 0 && fuzzy_minutes == 0) { remaining -= append_string(words, remaining, STR_MID); //is it noon? } else if (fuzzy_hours == 12 && fuzzy_minutes == 0) { remaining -= append_string(words, remaining, STR_NOON); } else if (fuzzy_hours == 0 || fuzzy_hours == 12){ remaining -= append_number(words, 12); } else { //get hour remaining -= append_number(words, fuzzy_hours % 12); } }