102
|
1 --- /tmp/m/glog-0.3.2/src/windows/port.h 2012-10-03 12:54:10.958149861 +0200
|
|
2 +++ port.h 2012-10-03 16:19:56.721837994 +0200
|
|
3 @@ -129,6 +129,27 @@
|
|
4 #define pthread_self GetCurrentThreadId
|
|
5 #define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2))
|
|
6
|
|
7 +#if defined(__MINGW32__)
|
|
8 +inline int localtime_s(tm * _tm, const time_t * time)
|
|
9 +{
|
|
10 + tm * posix_local_time_struct = localtime(time);
|
|
11 + if (posix_local_time_struct == NULL)
|
|
12 + {
|
|
13 + return 1;
|
|
14 + }
|
|
15 +
|
|
16 + *_tm = *posix_local_time_struct;
|
|
17 +
|
|
18 + return 0;
|
|
19 +}
|
|
20 +
|
|
21 +inline char* strerror_s(char* buf, size_t buflen, int errnum)
|
|
22 +{
|
|
23 + const char* str = strerror(errnum);
|
|
24 + return strncpy(buf, str, buflen - 1);
|
|
25 +}
|
|
26 +#endif
|
|
27 +
|
|
28 inline struct tm* localtime_r(const time_t* timep, struct tm* result) {
|
|
29 localtime_s(result, timep);
|
|
30 return result;
|