build support for detecting clock_gettime, with -lrt if needed
[bpt/guile.git] / libguile / stime.h
CommitLineData
0f2d19dd
JB
1/* classes: h_files */
2
0527e687
DH
3#ifndef SCM_STIME_H
4#define SCM_STIME_H
5
102dbb6f 6/* Copyright (C) 1995,1996,1997,1998,2000, 2003, 2006, 2008 Free Software Foundation, Inc.
1c299a6b 7 *
73be1d9e 8 * This library is free software; you can redistribute it and/or
53befeb7
NJ
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
1c299a6b 12 *
53befeb7
NJ
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
73be1d9e
MV
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
1c299a6b 17 *
73be1d9e
MV
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
53befeb7
NJ
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301 USA
73be1d9e 22 */
0527e687 23
0f2d19dd
JB
24\f
25
b4309c3c 26#include "libguile/__scm.h"
0f2d19dd 27
8a74f7f5
KR
28#include <unistd.h> /* for sysconf */
29
0f2d19dd 30\f
756414cf 31
8a74f7f5
KR
32/* This should be figured out by autoconf.
33
34 sysconf(_SC_CLK_TCK) is best, since it's the actual running kernel, not
35 some compile-time CLK_TCK. On glibc 2.3.2 CLK_TCK (when defined) is in
36 fact sysconf(_SC_CLK_TCK) anyway.
37
38 CLK_TCK is obsolete in POSIX. In glibc 2.3.2 it's defined by default,
39 but if you define _GNU_SOURCE or _POSIX_C_SOURCE to get other features
40 then it goes away. */
41
42#if ! defined(SCM_TIME_UNITS_PER_SECOND) && defined(_SC_CLK_TCK)
43# define SCM_TIME_UNITS_PER_SECOND ((int) sysconf (_SC_CLK_TCK))
44#endif
756414cf
MD
45#if ! defined(SCM_TIME_UNITS_PER_SECOND) && defined(CLK_TCK)
46# define SCM_TIME_UNITS_PER_SECOND ((int) CLK_TCK)
47#endif
48#if ! defined(SCM_TIME_UNITS_PER_SECOND) && defined(CLOCKS_PER_SEC)
49# define SCM_TIME_UNITS_PER_SECOND ((int) CLOCKS_PER_SEC)
50#endif
51#if ! defined(SCM_TIME_UNITS_PER_SECOND)
52# define SCM_TIME_UNITS_PER_SECOND 60
53#endif
54
55\f
33b001fd
MV
56SCM_API long scm_c_get_internal_run_time (void);
57SCM_API SCM scm_get_internal_real_time (void);
58SCM_API SCM scm_get_internal_run_time (void);
59SCM_API SCM scm_current_time (void);
60SCM_API SCM scm_gettimeofday (void);
61SCM_API SCM scm_localtime (SCM time, SCM zone);
62SCM_API SCM scm_gmtime (SCM time);
63SCM_API SCM scm_mktime (SCM sbd_time, SCM zone);
64SCM_API SCM scm_tzset (void);
65SCM_API SCM scm_times (void);
66SCM_API SCM scm_strftime (SCM format, SCM stime);
67SCM_API SCM scm_strptime (SCM format, SCM string);
102dbb6f 68SCM_INTERNAL void scm_init_stime (void);
0f2d19dd 69
0527e687 70#endif /* SCM_STIME_H */
89e00824
ML
71
72/*
73 Local Variables:
74 c-file-style: "gnu"
75 End:
76*/