13 #include "Synchronized.h"
25 void Wait(
double seconds)
27 if (seconds < 0.0)
return;
28 taskDelay((int32_t)((
double)sysClkRateGet() * seconds));
38 return Timer::GetFPGATimestamp();
49 clock_gettime(CLOCK_REALTIME,&tp);
50 double realTime = (double)tp.tv_sec + (
double)((double)tp.tv_nsec*1e-9);
63 , m_accumulatedTime (0.0)
69 m_semaphore = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE);
75 semDelete(m_semaphore);
88 double currentTime = GetFPGATimestamp();
95 result = (currentTime - m_startTime) + m_accumulatedTime;
99 result = m_accumulatedTime;
113 m_accumulatedTime = 0;
114 m_startTime = GetFPGATimestamp();
127 m_startTime = GetFPGATimestamp();
145 m_accumulatedTime = temp;
165 m_startTime += period;
179 double Timer::GetFPGATimestamp()
183 return GetFPGATime() * 1.0e-6;
189 uint32_t niTimestamp32(
void);
190 UINT64 niTimestamp64(
void);
199 double Timer::GetPPCTimestamp()
202 return niTimestamp64() / 33.0e6;
bool HasPeriodPassed(double period)