Skip to content

Commit

Permalink
Allow internal code to call "timegm" on Windows
Browse files Browse the repository at this point in the history
Fixes openenclave#3646

Signed-off-by: Dave Thaler <[email protected]>
  • Loading branch information
dthaler committed Oct 9, 2020
1 parent 325cb52 commit 2cb98db
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
4 changes: 0 additions & 4 deletions common/datetime.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,7 @@ oe_result_t oe_datetime_to_time_t(const oe_datetime_t* datetime, time_t* value)
timeinfo.tm_min = (int)datetime->minutes;
timeinfo.tm_sec = (int)datetime->seconds;

#ifdef _WIN32
tmp = _mkgmtime(&timeinfo);
#else
tmp = timegm(&timeinfo);
#endif

*value = tmp;

Expand Down
1 change: 1 addition & 0 deletions include/openenclave/internal/datetime.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ OE_EXTERNC_BEGIN

#ifdef _WIN32
#define gmtime_r(now, timeinfo) gmtime_s(timeinfo, now)
#define timegm(tm) _mkgmtime(tm)
#endif

/**
Expand Down
3 changes: 0 additions & 3 deletions tests/crypto/crl_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
#include <time.h>
#include "readfile.h"
#include "tests.h"
#if defined(_WIN32)
#define timegm _mkgmtime
#endif

#define ACCEPTABLE_ERROR_IN_SECONDS 60

Expand Down

0 comments on commit 2cb98db

Please sign in to comment.