53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
/*
|
|
Copyright 2010-2012 Grégory Soutadé
|
|
|
|
This file is part of KissCount.
|
|
|
|
KissCount is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
KissCount is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#include "compat.hpp"
|
|
|
|
// From http://old.nabble.com/Porting-localtime_r-and-gmtime_r-td15282276.html
|
|
struct tm *
|
|
localtime_r (const time_t *timer, struct tm *result)
|
|
{
|
|
struct tm *local_result;
|
|
local_result = localtime (timer);
|
|
|
|
if (local_result == NULL || result == NULL)
|
|
return NULL;
|
|
|
|
memcpy (result, local_result, sizeof (result));
|
|
return result;
|
|
}
|
|
|
|
struct tm *
|
|
gmtime_r (const time_t *timer, struct tm *result)
|
|
{
|
|
struct tm *local_result;
|
|
local_result = gmtime (timer);
|
|
|
|
if (local_result == NULL || result == NULL)
|
|
return NULL;
|
|
|
|
memcpy (result, local_result, sizeof (result));
|
|
return result;
|
|
}
|
|
|
|
#endif
|