-
Notifications
You must be signed in to change notification settings - Fork 37
/
os_mapping.cpp
58 lines (52 loc) · 1.59 KB
/
os_mapping.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Speeded-Up Robust Features (SURF)
* https://github.com/herbertbay/SURF
*
* Authors: Herbert Bay, Andreas Ess, Geert Willems
* Windows port by Stefan Saur
*
* Copyright (2006): ETH Zurich, Switzerland
* Katholieke Universiteit Leuven, Belgium
* All rights reserved.
*
* For details, see the paper:
* Herbert Bay, Tinne Tuytelaars, Luc Van Gool,
* "SURF: Speeded Up Robust Features"
* Proceedings of the ninth European Conference on Computer Vision, May 2006
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for educational, research, and non-commercial
* purposes, without fee and without a signed licensing agreement, is
* hereby granted, provided that the above copyright notice and this
* paragraph appear in all copies modifications, and distributions.
*
* Any commercial use or any redistribution of this software
* requires a license from one of the above mentioned establishments.
*
* For further details, contact Herbert Bay ([email protected]).
*/
#ifdef WIN32
#include <windows.h>
#include <process.h>
#else
#include <pthread.h>
#endif
#include "os_mapping.h"
namespace osmapping {
void os_GetTime(os_TIME *time) {
#ifdef WIN32
*time = GetTickCount();
#else
struct timezone tz;
gettimeofday(time, &tz);
#endif
}
int os_TimeDiff(os_TIME *time1, os_TIME *time2) {
#ifdef WIN32
return *time1 - *time2;
#else
return (int)((double)time1->tv_sec*1000 + ((double)time1->tv_usec)*1e-3 -
(double)time2->tv_sec*1000 - ((double)time2->tv_usec)*1e-3);
#endif
}
}