comparison vamp-sdk/RealTime.cpp @ 80:e33fa45f0935

* avoid trying to use timeval if building on Windows
author cannam
date Tue, 18 Sep 2007 09:39:58 +0000
parents 4412c619b373
children c8b48bc6db3d
comparison
equal deleted inserted replaced
79:c72fddf9aecb 80:e33fa45f0935
52 52
53 using std::cerr; 53 using std::cerr;
54 using std::endl; 54 using std::endl;
55 55
56 #include "RealTime.h" 56 #include "RealTime.h"
57
58 #ifndef _WIN32
57 #include "sys/time.h" 59 #include "sys/time.h"
60 #endif
58 61
59 namespace Vamp { 62 namespace Vamp {
60 63
61 // A RealTime consists of two ints that must be at least 32 bits each. 64 // A RealTime consists of two ints that must be at least 32 bits each.
62 // A signed 32-bit int can store values exceeding +/- 2 billion. This 65 // A signed 32-bit int can store values exceeding +/- 2 billion. This
94 RealTime::fromMilliseconds(int msec) 97 RealTime::fromMilliseconds(int msec)
95 { 98 {
96 return RealTime(msec / 1000, (msec % 1000) * 1000000); 99 return RealTime(msec / 1000, (msec % 1000) * 1000000);
97 } 100 }
98 101
102 #ifndef _WIN32
99 RealTime 103 RealTime
100 RealTime::fromTimeval(const struct timeval &tv) 104 RealTime::fromTimeval(const struct timeval &tv)
101 { 105 {
102 return RealTime(tv.tv_sec, tv.tv_usec * 1000); 106 return RealTime(tv.tv_sec, tv.tv_usec * 1000);
103 } 107 }
108 #endif
104 109
105 std::ostream &operator<<(std::ostream &out, const RealTime &rt) 110 std::ostream &operator<<(std::ostream &out, const RealTime &rt)
106 { 111 {
107 if (rt < RealTime::zeroTime) { 112 if (rt < RealTime::zeroTime) {
108 out << "-"; 113 out << "-";