Ardour  9.0-pre0-582-g084a23a80d
localtime_r.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013-2014 Paul Davis <paul@linuxaudiosystems.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef PBD_LOCALTIME_R
20 #define PBD_LOCALTIME_R
21 #include <time.h>
22 
23 #ifdef COMPILER_MSVC
24 
25 #define localtime_r( _clock, _result ) \
26  ( *(_result) = *localtime( (_clock) ), (_result) )
27 
28 #elif defined COMPILER_MINGW
29 
30 # ifdef localtime_r
31 # undef localtime_r
32 # endif
33 
34 // As in 64 bit time_t is 64 bit integer, compiler breaks compilation
35 // everytime implicit cast from long int* to time_t* worked in
36 // the past (32 bit). To unblock such a cast we added the localtime below:
37 extern struct tm *localtime(const long int *_Time);
38 extern struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
39 
40 #endif
41 
42 #endif