Skip to content

Commit

Permalink
Changed tm init for C++ to avoid warning for skipped initializers (#144)
Browse files Browse the repository at this point in the history
* Changed tm init for C++ to avoid warning for skipped initializers
* Fixed initialization to memset
  • Loading branch information
ethouris authored and rndi committed Oct 25, 2017
1 parent 044f494 commit 0ce9663
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions common/srt_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,17 @@ inline std::string SysStrError(int errnum)

inline struct tm LocalTime(time_t tt)
{
struct tm tm = {};
struct tm tms;
memset(&tms, 0, sizeof tms);
#ifdef WIN32
errno_t rr = localtime_s(&tm, &tt);
errno_t rr = localtime_s(&tms, &tt);
if (rr == 0)
return tm;
return tms;
#else
tm = *localtime_r(&tt, &tm);
tms = *localtime_r(&tt, &tms);
#endif

return tm;
return tms;
}


Expand Down

0 comments on commit 0ce9663

Please sign in to comment.