Skip to content
Snippets Groups Projects
Commit 2584090b authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Attempt to silence Coverity warnings about time32_t.

parent 63cec349
No related branches found
No related tags found
No related merge requests found
Pipeline #5917 passed
...@@ -63,18 +63,22 @@ time_t sane_timegm(struct tm* tm) ...@@ -63,18 +63,22 @@ time_t sane_timegm(struct tm* tm)
time32_t time32(time32_t* tp) time32_t time32(time32_t* tp)
{ {
time_t t; time_t t;
uint32_t t32;
t=time(NULL); t=time(NULL);
t32 = t & UINT32_MAX;
if(tp!=NULL) if(tp!=NULL)
*tp=(time32_t)t; *tp=(time32_t)t32;
return (time32_t)t; return (time32_t)t32;
} }
time32_t mktime32(struct tm* tm) time32_t mktime32(struct tm* tm)
{ {
return (time32_t)mktime(tm); /* don't use sane_mktime since tm->tm_mon is assumed to be already zero-based */ time_t t = mktime(tm);
uint32_t t32 = t & UINT32_MAX;
return (time32_t)t32; /* don't use sane_mktime since tm->tm_mon is assumed to be already zero-based */
} }
struct tm* localtime32(const time32_t* t32, struct tm* tm) struct tm* localtime32(const time32_t* t32, struct tm* tm)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment