diff --git a/lib/roken/NTMakefile b/lib/roken/NTMakefile index fd15f0dea..a9f7eaf03 100644 --- a/lib/roken/NTMakefile +++ b/lib/roken/NTMakefile @@ -67,6 +67,7 @@ libroken_la_OBJS = \ $(OBJ)\hostent_find_fqdn.obj \ $(OBJ)\inet_aton.obj \ $(OBJ)\issuid.obj \ + $(OBJ)\localtime_r.obj \ $(OBJ)\lstat.obj \ $(OBJ)\mini_inetd.obj \ $(OBJ)\mkstemp.obj \ diff --git a/lib/roken/localtime_r.c b/lib/roken/localtime_r.c index e7d03ef6d..fa3d1269d 100644 --- a/lib/roken/localtime_r.c +++ b/lib/roken/localtime_r.c @@ -42,6 +42,11 @@ ROKEN_LIB_FUNCTION struct tm * ROKEN_LIB_CALL localtime_r(const time_t *timer, struct tm *result) { +#ifdef _MSC_VER + + return (localtime_s(result, timer) == 0)? result : NULL; + +#else struct tm *tm; tm = localtime((time_t *)timer); @@ -49,6 +54,7 @@ localtime_r(const time_t *timer, struct tm *result) return NULL; *result = *tm; return result; +#endif } #endif