+ void do_log (shared_ptr<const LogEntry> entry)
+ {
+ time_t const s = entry->seconds ();
+ struct tm* local = localtime (&s);
+ if (
+ !_last_time ||
+ local->tm_yday != _last_time->tm_yday ||
+ local->tm_year != _last_time->tm_year ||
+ local->tm_hour != _last_time->tm_hour ||
+ local->tm_min != _last_time->tm_min
+ ) {
+ char buffer[64];
+ strftime (buffer, 64, "%c", local);
+ append (buffer);
+ }
+
+ append (entry->message ());
+ if (_log.size() > log_lines) {
+ emit (boost::bind (boost::ref (Removed), _log.front().length()));
+ _log.pop_front ();
+ }
+ _last_time = *local;
+
+ shared_ptr<const EncodedLogEntry> encoded = dynamic_pointer_cast<const EncodedLogEntry> (entry);
+ if (encoded) {
+ _history.push_back (encoded->seconds ());
+ if (_history.size() > 48) {
+ _history.pop_front ();
+ }
+ if (_history.size() > 2) {
+ boost::mutex::scoped_lock lm (_state_mutex);
+ _fps = _history.size() / (_history.back() - _history.front());
+ }
+ }
+ }
+
+ void append (string s)