00001 #include <log4cpp/Portability.hh>
00002 #include "Localtime.hh"
00003 #include <time.h>
00004 #include <memory.h>
00005
00006 namespace log4cpp
00007 {
00008
00009 #if defined(_MSC_VER) && defined(LOG4CPP_HAVE_LOCALTIME_R)
00010 void localtime(const ::time_t* time, ::tm* t)
00011 {
00012 localtime_s(t, time);
00013 }
00014 #endif
00015
00016 #if !defined(_MSC_VER) && defined(LOG4CPP_HAVE_LOCALTIME_R)
00017 void localtime(const ::time_t* time, ::tm* t)
00018 {
00019 localtime_r(time, t);
00020 }
00021 #endif
00022
00023 #if !defined(LOG4CPP_HAVE_LOCALTIME_R)
00024 void localtime(const ::time_t* time, ::tm* t)
00025 {
00026 ::tm* tmp = ::localtime(time);
00027 memcpy(t, tmp, sizeof(::tm));
00028 }
00029 #endif
00030
00031 }