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

Treat -1 as invalid time in time_as_hhmm()

parent 3bef4201
No related branches found
No related tags found
No related merge requests found
Pipeline #7170 passed
......@@ -21,6 +21,7 @@
#include "date_str.h"
#include "datewrap.h"
#include "xpdatetime.h"
#include "text.h"
const char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
......@@ -238,7 +239,7 @@ char* tm_as_hhmm(scfg_t* cfg, struct tm* tm, char* str)
char* time_as_hhmm(scfg_t* cfg, time_t t, char* str)
{
struct tm tm;
if(localtime_r(&t, &tm) == NULL) {
if(t == INVALID_TIME || localtime_r(&t, &tm) == NULL) {
strcpy(str,"??:??");
return str;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment