77 inline explicit CEndTime(
unsigned int millisecondsIntoTheFuture)
78 : m_startTime(std::chrono::system_clock::now().time_since_epoch()),
79 m_totalWaitTime(std::chrono::milliseconds(millisecondsIntoTheFuture))
90 inline void Set(
unsigned int millisecondsIntoTheFuture)
92 using namespace std::chrono;
94 m_startTime = system_clock::now().time_since_epoch();
95 m_totalWaitTime = milliseconds(millisecondsIntoTheFuture);
107 using namespace std::chrono;
110 if (m_totalWaitTime.count() == std::numeric_limits<unsigned int>::max())
113 if (m_totalWaitTime.count() == 0)
116 return (system_clock::now().time_since_epoch() - m_startTime) >= m_totalWaitTime;
128 using namespace std::chrono;
131 if (m_totalWaitTime.count() == std::numeric_limits<unsigned int>::max())
132 return std::numeric_limits<unsigned int>::max();
134 if (m_totalWaitTime.count() == 0)
137 auto elapsed = system_clock::now().time_since_epoch() - m_startTime;
139 auto timeWaitedAlready = duration_cast<milliseconds>(elapsed).count();
141 if (timeWaitedAlready >= m_totalWaitTime.count())
144 return static_cast<unsigned int>(m_totalWaitTime.count() - timeWaitedAlready);
154 using namespace std::chrono;
155 m_totalWaitTime = milliseconds(0);
165 using namespace std::chrono;
166 m_totalWaitTime = milliseconds(std::numeric_limits<unsigned int>::max());
178 return (m_totalWaitTime.count() == std::numeric_limits<unsigned int>::max());
190 auto value = std::chrono::duration_cast<std::chrono::milliseconds>(m_totalWaitTime);
191 return static_cast<unsigned int>(value.count());
202 auto value = std::chrono::duration_cast<std::chrono::milliseconds>(m_startTime);
203 return value.count();
208 std::chrono::system_clock::duration m_startTime;
209 std::chrono::system_clock::duration m_totalWaitTime;