comparison src/vamp-sdk/RealTime.cpp @ 421:35fa4733bc5d

Fix compiler warnings, and fix potential mangling of utf8 when downcasing (this is still a nasty and incomplete way to do it though)
author Chris Cannam
date Thu, 14 Apr 2016 11:49:12 +0100
parents 6f88563ea26f
children e2716b9352ca
comparison
equal deleted inserted replaced
420:99868cd95acb 421:35fa4733bc5d
110 110
111 #ifndef _WIN32 111 #ifndef _WIN32
112 RealTime 112 RealTime
113 RealTime::fromTimeval(const struct timeval &tv) 113 RealTime::fromTimeval(const struct timeval &tv)
114 { 114 {
115 return RealTime(tv.tv_sec, tv.tv_usec * 1000); 115 return RealTime(int(tv.tv_sec), int(tv.tv_usec * 1000));
116 } 116 }
117 #endif 117 #endif
118 118
119 std::ostream &operator<<(std::ostream &out, const RealTime &rt) 119 std::ostream &operator<<(std::ostream &out, const RealTime &rt)
120 { 120 {
234 RealTime::frame2RealTime(long frame, unsigned int sampleRate) 234 RealTime::frame2RealTime(long frame, unsigned int sampleRate)
235 { 235 {
236 if (frame < 0) return -frame2RealTime(-frame, sampleRate); 236 if (frame < 0) return -frame2RealTime(-frame, sampleRate);
237 237
238 RealTime rt; 238 RealTime rt;
239 rt.sec = frame / long(sampleRate); 239 rt.sec = int(frame / long(sampleRate));
240 frame -= rt.sec * long(sampleRate); 240 frame -= rt.sec * long(sampleRate);
241 rt.nsec = (int)(((double(frame) * 1000000.0) / sampleRate) * 1000.0); 241 rt.nsec = (int)(((double(frame) * 1000000.0) / sampleRate) * 1000.0);
242 return rt; 242 return rt;
243 } 243 }
244 244