1
/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
4
* Copyright (C) 1997-2002 Stuart Parmenter and others,
5
* See the file AUTHORS for a list.
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2, or (at your option)
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
29
static pthread_mutex_t time_lock = PTHREAD_MUTEX_INITIALIZER;
30
#define LOCK(mutex) pthread_mutex_lock(&mutex)
31
#define UNLOCK(mutex) pthread_mutex_unlock(&mutex)
35
#endif /* HAVE_THREADS */
42
ctime_r(const time_t *clock, char *buf)
45
strcpy(buf, ctime(clock));
52
#ifndef HAVE_LOCALTIME_R
54
localtime_r(const time_t *clock, struct tm *result)
57
memcpy(result, localtime(clock), sizeof(struct tm));
66
gmtime_r(const time_t *clock, struct tm *result)
69
memcpy(result, gmtime(clock), sizeof(struct tm));