diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2009-02-28 12:14:00 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2009-02-28 12:14:00 +0100 |
commit | 928fc83a6492e6ceaf7a46b888526e20bcd3a6dc (patch) | |
tree | eebcf82d1ecdd0ac592bb2e33c0241e48a4f93d3 /src/port/time.c | |
parent | b4cf78d1eaed900aa6acbcab01bc8693c88b0275 (diff) | |
download | wolfbones-928fc83a6492e6ceaf7a46b888526e20bcd3a6dc.tar.gz wolfbones-928fc83a6492e6ceaf7a46b888526e20bcd3a6dc.tar.bz2 |
added localtime_r with stub to tests
Diffstat (limited to 'src/port/time.c')
-rw-r--r-- | src/port/time.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/port/time.c b/src/port/time.c index 15ccba3..c96d6e2 100644 --- a/src/port/time.c +++ b/src/port/time.c @@ -1,14 +1,32 @@ +/* + Copyright (C) 2008 Andreas Baumann <abaumann@yahoo.com> + + This program 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. + + This program 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 this program. If not, see <http://www.gnu.org/licenses/>. +*/ + #include "port/time.h" -#if !defined HAVE_LOCALTIME_R +#if !defined HAVE_LOCALTIME_R || defined TEST_LOCALTIME_R + +#if defined HAVE_PTHREADS -/* TODO: port mutexes */ #include <pthread.h> /* for pthread_X */ #include "port/stdbool.h" /* for bool */ #include "port/string.h" /* for memcpy */ -struct tm *localtime_r( const time_t *timep, struct tm *result ) { +struct tm *wolf_port_localtime_r( const time_t *timep, struct tm *result ) { static pthread_mutex_t mutex; static bool first = true; struct tm *local_result; @@ -28,4 +46,8 @@ struct tm *localtime_r( const time_t *timep, struct tm *result ) { return ( local_result != NULL ) ? result : NULL; } +#else +#error no pthreads, port localtime_r differently! +#endif + #endif /* !defined HAVE_LOCALTIME_R */ |