Skip to content

Commit

Permalink
condense code in hasViewers
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Connor committed Oct 28, 2024
1 parent 59f1748 commit 6fe9d9d
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/zm_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,6 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
}
return false;
}

inline unsigned int Id() const { return id; }
inline const char *Name() const { return name.c_str(); }
inline bool Deleted() const { return deleted; }
Expand Down Expand Up @@ -767,17 +766,9 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
bool hasViewers() {
if (shared_data && shared_data->valid) {
SystemTimePoint now = std::chrono::system_clock::now();
Debug(3, "Last viewed %" PRId64 " seconds ago",
static_cast<int64>(std::chrono::duration_cast<Seconds>(now.time_since_epoch()).count())
-
shared_data->last_viewed_time
);
return (
(
static_cast<int64>(std::chrono::duration_cast<Seconds>(now.time_since_epoch()).count())
-
shared_data->last_viewed_time
) > 10 ? false : true);
int64 intNow = static_cast<int64>(std::chrono::duration_cast<Seconds>(now.time_since_epoch()).count());
Debug(3, "Last viewed %" PRId64 " seconds ago", intNow - shared_data->last_viewed_time);
return (((!shared_data->last_viewed_time) or ((intNow - shared_data->last_viewed_time)) > 10)) ? false : true;
}
return false;
}
Expand Down

0 comments on commit 6fe9d9d

Please sign in to comment.