Revision 90fa4b4e server/src/Animation.cpp
server/src/Animation.cpp | ||
---|---|---|
27 | 27 |
*/ |
28 | 28 |
|
29 | 29 |
#include "Animation.h" |
30 |
#include <stdexcept> |
|
31 |
|
|
30 | 32 |
using namespace std; |
31 |
using namespace boost; |
|
32 | 33 |
|
33 | 34 |
Animation::Animation() { |
34 | 35 |
active = false; |
... | ... | |
51 | 52 |
|
52 | 53 |
// Set up end time |
53 | 54 |
int duration = duration_each * repetitions; |
54 |
start_time = get_system_time(); // posix_time::microsec_clock::local_time();
|
|
55 |
end_time = start_time + boost::posix_time::milliseconds(duration);
|
|
55 |
start_time = std::chrono::steady_clock::now();
|
|
56 |
end_time = start_time + std::chrono::milliseconds(duration);
|
|
56 | 57 |
} |
57 | 58 |
|
58 | 59 |
bool Animation::is_active() { |
... | ... | |
147 | 148 |
} |
148 | 149 |
|
149 | 150 |
// now check if this animation ended: |
150 |
system_time now = get_system_time(); // posix_time::microsec_clock::local_time();
|
|
151 |
std::chrono::time_point<std::chrono::steady_clock> now = std::chrono::steady_clock::now();
|
|
151 | 152 |
if (now > end_time) { |
152 | 153 |
active = false; |
153 | 154 |
return; |
154 | 155 |
} |
155 | 156 |
|
156 | 157 |
// milliseconds from the beginning of this ani: |
157 |
posix_time::time_duration diff = now - start_time; |
|
158 |
float elapsed_ms = diff.total_milliseconds(); |
|
159 |
// printf("mili %f\n",elapsed_ms); |
|
158 |
float elapsed_ms = std::chrono::duration<float, milli>(now - start_time).count(); |
|
159 |
// printf("milli %f\n",elapsed_ms); |
|
160 | 160 |
|
161 | 161 |
float max_elongation = 0.0; |
162 | 162 |
float profile = 0.0; |
Also available in: Unified diff