A Survey of Gaussian Convolution Algorithms
Main Page
Modules
Files
File List
Globals
basic.c
Go to the documentation of this file.
1
20
#include "
basic.h
"
21
22
/* Autodetect whether to use Windows, POSIX,
23
or fallback implementation for Clock. */
24
#if !defined(USE_GETSYSTEMTIME) && !defined(USE_GETTIMEOFDAY) && !defined(USE_TIME)
25
# if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
26
# define USE_GETSYSTEMTIME
27
# elif defined(unix) || defined(__unix__) || defined(__unix)
28
# include <unistd.h>
29
# if (_POSIX_TIMERS) || (_POSIX_VERSION >= 200112L)
30
# define USE_GETTIMEOFDAY
31
# endif
32
# endif
33
#endif
34
35
/* Define millisecond_timer(), get the system clock in milliseconds */
36
#if defined(USE_GETSYSTEMTIME)
37
#define WIN32_LEAN_AND_MEAN
38
#include <windows.h>
39
40
unsigned
long
millisecond_timer
()
/* Windows implementation */
41
{
42
static
SYSTEMTIME t;
43
GetSystemTime(&t);
44
return
(
unsigned
long
)((
unsigned
long)t.wMilliseconds
45
+ 1000*((
unsigned
long
)t.wSecond
46
+ 60*((
unsigned
long)t.wMinute
47
+ 60*((
unsigned
long
)t.wHour
48
+ 24*(
unsigned
long)t.wDay))));
49
}
50
#elif defined(USE_GETTIMEOFDAY)
51
#include <unistd.h>
52
#include <sys/time.h>
53
54
unsigned
long
millisecond_timer
()
/* POSIX implementation */
55
{
56
struct
timeval t;
57
gettimeofday(&t, NULL);
58
return
(
unsigned
long
)(t.tv_usec/1000 + t.tv_sec*1000);
59
}
60
#else
61
#include <time.h>
62
63
unsigned
long
millisecond_timer
()
/* Fallback implementation */
64
{
65
time_t raw_time;
66
struct
tm *t;
67
time(&raw_time);
68
t = localtime(&raw_time);
69
return
(
unsigned
long
)(1000*((
unsigned
long)t->tm_sec
70
+ 60*((
unsigned
long
)t->tm_min
71
+ 60*((
unsigned
long)t->tm_hour
72
+ 24*(
unsigned
long
)t->tm_mday))));
73
}
74
#endif
75
Generated on Sat Dec 14 2013 21:33:17 for A Survey of Gaussian Convolution Algorithms by
1.8.3.1