Added function description

This commit is contained in:
anschrammh 2020-12-13 21:16:29 +01:00
parent 7d2ceedc9a
commit bcc185bf5d

View File

@ -68,7 +68,10 @@ char *lastIndexOf(char *str, const char character)
return last; return last;
} }
/**
* The monthNumTo3LetterAbbreviation function takes the month number from 1 to 12 and returns the abbreviation in a 3 letter
* format.
*/
char *monthNumTo3LetterAbbreviation(char *buffer, const uint8_t monthNumber) char *monthNumTo3LetterAbbreviation(char *buffer, const uint8_t monthNumber)
{ {
static const char monthArray[][4] = {{"Jan"},{"Feb"},{"Mar"},{"Apr"},{"May"},{"Jun"},{"Jul"},{"Aug"},{"Sep"},{"Oct"},{"Nov"},{"Dec"}}; static const char monthArray[][4] = {{"Jan"},{"Feb"},{"Mar"},{"Apr"},{"May"},{"Jun"},{"Jul"},{"Aug"},{"Sep"},{"Oct"},{"Nov"},{"Dec"}};
@ -77,7 +80,7 @@ char *monthNumTo3LetterAbbreviation(char *buffer, const uint8_t monthNumber)
if(monthNumber >= 1 && monthNumber <= 12) if(monthNumber >= 1 && monthNumber <= 12)
strcpy_P(buffer, monthArray[monthNumber-1]); strcpy_P(buffer, monthArray[monthNumber-1]);
else //Default is january else //If the month number is garbage, we return the first month of the year
strcpy_P(buffer, monthArray[0]); strcpy_P(buffer, monthArray[0]);
return buffer; return buffer;