Skip to content
Snippets Groups Projects
Commit eff23a68 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix extra char output from datestr() when given a time_t value of 0.

parent 196ad130
No related branches found
No related tags found
No related merge requests found
...@@ -152,23 +152,25 @@ char* unixtodstr(scfg_t* cfg, time32_t t, char *str) ...@@ -152,23 +152,25 @@ char* unixtodstr(scfg_t* cfg, time32_t t, char *str)
} }
/****************************************************************************/ /****************************************************************************/
/* Return 8-char numeric or verbal date */
/****************************************************************************/ /****************************************************************************/
char* datestr(scfg_t* cfg, time_t t, char* str) char* datestr(scfg_t* cfg, time_t t, char* str)
{ {
if(t == 0) if(t == 0)
return "---------"; return "--------";
if(!cfg->sys_date_verbal) if(!cfg->sys_date_verbal)
return unixtodstr(cfg, (time32_t)t, str); return unixtodstr(cfg, (time32_t)t, str);
return verbal_datestr(cfg, t, str); return verbal_datestr(cfg, t, str);
} }
/****************************************************************************/ /****************************************************************************/
/* return 8-char numeric date */
/****************************************************************************/ /****************************************************************************/
char* verbal_datestr(scfg_t* cfg, time_t t, char* str) char* verbal_datestr(scfg_t* cfg, time_t t, char* str)
{ {
struct tm tm = {0}; struct tm tm = {0};
if(localtime_r(&t, &tm) == NULL) if(localtime_r(&t, &tm) == NULL)
return "!!!!!!!!!"; return "!!!!!!!!";
char fmt[32] = ""; char fmt[32] = "";
switch(cfg->sys_date_fmt) { switch(cfg->sys_date_fmt) {
case MMDDYY: case MMDDYY:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment