summaryrefslogtreecommitdiff
path: root/legacy/evil/src/lib/evil_time.c
blob: 80fbae1569f9f5584919b6d290b511c29282a2d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */

#include "Evil.h"
#include "evil_private.h"


struct tm *
localtime_r(const time_t *timep, struct tm *result)
{
#ifndef _MSC_VER
   struct tm *tmp;
#endif /* ! _MSC_VER */

   if (!timep || !result)
     return NULL;

#ifdef _MSC_VER
   if (localtime_s(result, timep) != 0)
     return NULL;
#else
   tmp = localtime(timep);
   if (!tmp)
     return NULL;

   memcpy(result, tmp, sizeof(struct tm));

#endif /* ! _MSC_VER */

   return result;
}