diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/event_history.cc | 22 | ||||
| -rw-r--r-- | src/lib/event_history.h | 8 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/event_history.cc b/src/lib/event_history.cc index fca88aaf1..f68a6c9b9 100644 --- a/src/lib/event_history.cc +++ b/src/lib/event_history.cc @@ -27,37 +27,37 @@ using boost::optional; -EventHistory::EventHistory (int size) - : _size (size) +EventHistory::EventHistory(int size) + : _size(size) { } optional<float> -EventHistory::rate () const +EventHistory::rate() const { - boost::mutex::scoped_lock lock (_mutex); + boost::mutex::scoped_lock lock(_mutex); if (int(_history.size()) < _size) { return {}; } struct timeval now; - gettimeofday (&now, 0); + gettimeofday(&now, 0); - return _size / (seconds (now) - seconds (_history.back ())); + return _size / (seconds(now) - seconds(_history.back())); } void -EventHistory::event () +EventHistory::event() { - boost::mutex::scoped_lock lock (_mutex); + boost::mutex::scoped_lock lock(_mutex); struct timeval tv; - gettimeofday (&tv, 0); - _history.push_front (tv); + gettimeofday(&tv, 0); + _history.push_front(tv); if (int(_history.size()) > _size) { - _history.pop_back (); + _history.pop_back(); } } diff --git a/src/lib/event_history.h b/src/lib/event_history.h index a98447f42..63329fa0e 100644 --- a/src/lib/event_history.h +++ b/src/lib/event_history.h @@ -23,18 +23,18 @@ #define DCPOMATIC_EVENT_HISTORY_H -#include <boost/thread/mutex.hpp> #include <boost/optional.hpp> +#include <boost/thread/mutex.hpp> #include <list> class EventHistory { public: - explicit EventHistory (int size); + explicit EventHistory(int size); - boost::optional<float> rate () const; - void event (); + boost::optional<float> rate() const; + void event(); private: /** Mutex for _history */ |
