NFFT 3.5.3alpha
time.c
1/*
2 * Copyright (c) 2002, 2017 Jens Keiner, Stefan Kunis, Daniel Potts
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License as published by the Free Software
6 * Foundation; either version 2 of the License, or (at your option) any later
7 * version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#include "infft.h"
20
21#ifdef HAVE_TIME_H
22#include <time.h>
23#endif
24
25R Y(elapsed_seconds)(ticks t1, ticks t0)
26{
27 UNUSED(t1);
28 UNUSED(t0);
29 return (R)(elapsed(t1,t0)) / (R)(TICKS_PER_SECOND);
30}
31
32R Y(clock_gettime_seconds)(void)
33{
34#if defined(HAVE_CLOCK_GETTIME)
35 struct timespec tp;
36 if (clock_gettime(CLOCK_REALTIME, &tp) != 0)
37 {
38 tp.tv_sec = 0;
39 tp.tv_nsec = 0;
40 }
41
42 return tp.tv_sec+(R)tp.tv_nsec/K(1e9);
43#else
44 return K(0.0);
45#endif
46}
47
#define UNUSED(x)
Dummy use of unused parameters to silence compiler warnings.
Definition infft.h:1319
Internal header file for auxiliary definitions and functions.