libreplace: add clock_gettime replacement function for systems that don't have it
[Samba/gbeck.git] / lib / replace / system / time.h
blobff26531e45b8d4b179056e659799f8ceb25227e4
1 #ifndef _system_time_h
2 #define _system_time_h
3 /*
4 Unix SMB/CIFS implementation.
6 time system include wrappers
8 Copyright (C) Andrew Tridgell 2004
10 ** NOTE! The following LGPL license applies to the replace
11 ** library. This does NOT imply that all of Samba is released
12 ** under the LGPL
14 This library is free software; you can redistribute it and/or
15 modify it under the terms of the GNU Lesser General Public
16 License as published by the Free Software Foundation; either
17 version 3 of the License, or (at your option) any later version.
19 This library is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 Lesser General Public License for more details.
24 You should have received a copy of the GNU Lesser General Public
25 License along with this library; if not, see <http://www.gnu.org/licenses/>.
29 #ifdef TIME_WITH_SYS_TIME
30 #include <sys/time.h>
31 #include <time.h>
32 #else
33 #ifdef HAVE_SYS_TIME_H
34 #include <sys/time.h>
35 #else
36 #include <time.h>
37 #endif
38 #endif
40 #ifdef HAVE_UTIME_H
41 #include <utime.h>
42 #else
43 struct utimbuf {
44 time_t actime; /* access time */
45 time_t modtime; /* modification time */
47 #endif
49 #ifndef HAVE_MKTIME
50 /* define is in "replace.h" */
51 time_t rep_mktime(struct tm *t);
52 #endif
54 #ifndef HAVE_TIMEGM
55 /* define is in "replace.h" */
56 time_t rep_timegm(struct tm *tm);
57 #endif
59 #ifndef HAVE_UTIME
60 /* define is in "replace.h" */
61 int rep_utime(const char *filename, const struct utimbuf *buf);
62 #endif
64 #ifndef HAVE_UTIMES
65 /* define is in "replace.h" */
66 int rep_utimes(const char *filename, const struct timeval tv[2]);
67 #endif
69 #ifndef HAVE_CLOCK_GETTIME
70 #define CLOCK_REALTIME 0
71 typedef int clockid_t;
72 int rep_clock_gettime(clockid_t clk_id, struct timespec *tp);
73 #endif
75 #endif