Navigation Menu

Skip to content

Commit

Permalink
win32: use gmtime_s instead of gmtime_r
Browse files Browse the repository at this point in the history
TODO: use better workaroud for avoiding segmentation fault.
This is temporary fix for investigating further win32 related issues.
  • Loading branch information
kenhys committed Oct 12, 2012
1 parent e5f4dc8 commit 68e0185
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ha_mroonga.cpp
Expand Up @@ -41,6 +41,7 @@
#ifdef WIN32
# include <math.h>
# include <direct.h>
# include <time.h>
# define MRN_MKDIR(pathname, mode) _mkdir((pathname))
# define MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(type, variable_name, variable_size) \
type *variable_name = (type *)_malloca(sizeof(type) * variable_size)
Expand Down Expand Up @@ -1620,7 +1621,11 @@ static void mrn_init_time(void)
struct tm now_tm;
time_t now;
time(&now);
#ifdef _MSC_VER
gmtime_s(&now_tm, &now);
#else
gmtime_r(&now, &now_tm);
#endif
mrn_utc_diff_in_seconds = now - mktime(&now_tm);
}

Expand Down

0 comments on commit 68e0185

Please sign in to comment.