1 /* -*- mode: c; c-file-style: "bsd"; -*- */
3 Copyright (C) 2001-2003 Paul Davis
4 Copyright (C) 2005 Jussi Laako
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include <sys/types.h>
34 #include <jack/internal.h>
35 #include <jack/jack.h>
36 #include <jack/engine.h>
38 #include <sysdeps/time.h>
39 #include <sysdeps/cycles.h>
44 jack_clock_source_name (jack_timer_type_t src
)
47 case JACK_TIMER_CYCLE_COUNTER
:
48 return "cycle counter";
51 case JACK_TIMER_SYSTEM_CLOCK
:
52 #ifdef HAVE_CLOCK_GETTIME
53 return "system clock via clock_gettime";
55 return "system clock via gettimeofday";
59 /* what is wrong with gcc ? */
64 #ifndef HAVE_CLOCK_GETTIME
67 jack_get_microseconds_from_system (void) {
71 gettimeofday (&tv
, NULL
);
72 jackTime
= (jack_time_t
) tv
.tv_sec
* 1000000 + (jack_time_t
) tv
.tv_usec
;
79 jack_get_microseconds_from_system (void) {
83 clock_gettime(CLOCK_MONOTONIC
, &time
);
84 jackTime
= (jack_time_t
) time
.tv_sec
* 1e6
+
85 (jack_time_t
) time
.tv_nsec
/ 1e3
;
89 #endif /* HAVE_CLOCK_GETTIME */
91 /* everything below here should be system-dependent */
93 #include <sysdeps/time.c>