~ubuntu-branches/ubuntu/wily/log4cpp/wily-proposed

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
#include <log4cpp/Portability.hh>
#include "Localtime.hh"
#include <time.h>
#include <memory.h>

namespace log4cpp         
{

#if defined(_MSC_VER) && defined(LOG4CPP_HAVE_LOCALTIME_R)
   void localtime(const ::time_t* time, ::tm* t)
   {
      localtime_s(t, time);  
   }
#endif

#if !defined(_MSC_VER) && defined(LOG4CPP_HAVE_LOCALTIME_R)
   void localtime(const ::time_t* time, ::tm* t)
   {
      localtime_r(time, t);
   }
#endif

#if !defined(LOG4CPP_HAVE_LOCALTIME_R)
   void localtime(const ::time_t* time, ::tm* t)
   {
      ::tm* tmp = ::localtime(time);
      memcpy(t, tmp, sizeof(::tm));
   }
#endif

}