Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/stata/readstat_dta_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ static readstat_error_t dta_emit_header_time_stamp(readstat_writer_t *writer, dt
if (writer->timestamp != 0) {
time_t now = writer->timestamp;
struct tm time_buf;
#if !defined _MSC_VER
struct tm *time_s = localtime_r(&now, &time_buf);
#else
errno_t time_err = localtime_s(&time_buf, &now);
struct tm *time_s = (time_err == 0) ? &time_buf : NULL;
#endif

if (!time_s || time_s->tm_mon < 0 || time_s->tm_mon > 11) {
error = READSTAT_ERROR_BAD_TIMESTAMP_VALUE;
Expand Down
Loading