Beispiel #1
0
bool Debounce(int dtime) {
    const Poco::Timespan TimeOut(0, 1000*dtime);
    if (fpsTimeLast.isElapsed(TimeOut.totalMicroseconds())) {
        fpsTimeLast.update();
        return true;
    } else {
        return false;
    }
}
Beispiel #2
0
Command Command::set(const std::string& key, const std::string& value, bool overwrite, const Poco::Timespan& expireTime, bool create)
{
	Command cmd("SET");

	cmd << key << value;
	if (! overwrite) cmd << "NX";
	if (! create) cmd << "XX";
	if (expireTime.totalMicroseconds() > 0) cmd << "PX" << expireTime.totalMilliseconds();

	return cmd;
}
Beispiel #3
0
void QuotaForInterval::checkAndAddExecutionTime(time_t current_time, const String & quota_name, const String & user_name, Poco::Timespan amount)
{
    /// Information about internals of Poco::Timespan used.
    used.execution_time_usec += amount.totalMicroseconds();
    checkExceeded(current_time, quota_name, user_name);
}
bool MapWindow::RenderTimeAvailable() {
    const Poco::Timespan RenderInterval(0, 700*1000); // 700ms

    // it's been less than 700 ms since last data was posted
    return !MapDirty && !timestamp_newdata.isElapsed(RenderInterval.totalMicroseconds());
}