diff --git a/src/sbbs3/date_str.c b/src/sbbs3/date_str.c index d01d5f7b53d96bce91a0fc1c3b6fa4a22e02c035..c1ef7cca99e268da483bc0f55702528af67978e2 100644 --- a/src/sbbs3/date_str.c +++ b/src/sbbs3/date_str.c @@ -131,6 +131,16 @@ char* seconds_to_str(uint seconds, char* str) return p; } +/* Returns a duration in minutes into a string */ +char* minutes_to_str(uint min, char* str, size_t size) +{ + safe_snprintf(str, size, "%ud %uh %um" + ,min / (24 *60) + ,(min % (24 * 60)) / 60 + ,min % 60); + return str; +} + /****************************************************************************/ /****************************************************************************/ char* hhmmtostr(scfg_t* cfg, struct tm* tm, char* str) diff --git a/src/sbbs3/date_str.h b/src/sbbs3/date_str.h index 013d0eede4a1d38ad8dcd8ccf445080a9545d69b..8f43fc72ab441dd9532efa25f326a645f8e948a6 100644 --- a/src/sbbs3/date_str.h +++ b/src/sbbs3/date_str.h @@ -39,8 +39,9 @@ DLLEXPORT char * sectostr(uint sec, char *str); DLLEXPORT char * seconds_to_str(uint, char*); DLLEXPORT char * hhmmtostr(scfg_t* cfg, struct tm* tm, char* str); DLLEXPORT char * timestr(scfg_t* cfg, time32_t intime, char* str); +DLLEXPORT char* minutes_to_str(uint min, char* str, size_t); #ifdef __cplusplus } #endif -#endif /* Don't add anything after this line */ \ No newline at end of file +#endif /* Don't add anything after this line */