If I remember things correctly (someone corrects me if I'm wrong), it's whenever you're active.
So, let's say you're logged in, and then you visit a page, you are then considered "active" for the next 15 minutes and that's counted towards your logged-in hours. If you visit another page after 5 minutes only, then it'll start recounting after those five minutes which would make your logged-in hours 20 minutes.
I strongly believe it works that way as it only accounts for activity time and not login time. If not, why will an account that frequently login in for a whole year have less than 20 hours as it's time when it's literally online the whole day.
It's activities that's counts and not login time even though it is counted as total logged in time on our pages.
Yes, like you, I believe it's the activity, but you first got me worried when I read the activity, I mistook it for the activity reading of the forum which counts every 14 days..lol.
But really, I have thought about this thoroughly, it's a matter of the user's activities to be candid. But the analogy of the frequent login and in a year amounting to a 20-hour history is not so tally, the forum reads it differently as it reads users activeness on the forum, not the entire activity. This explains why users why two users who log in frequently throughout the year will not have the same activity count. This is because what we often see as the activity count is actually not, you can note this especially when you are on a topic for a long time, you might think it counts as an active session, but no, it might have stopped counting.
What I suspect is that the system has an internal counter that keeps you in an active session or otherwise even if you are still active on the forum, and my experience, the session timer of topics/sessions varies. A good way to know this is when you are typing a topic that has much body, and you have typed so much even as you make corrections. When you eventually click "send," the system might say you are not in an active session due to time out. The system must have timed you out in that process. This is even as you were typing and still active on the forum, the system no longer recognised that anymore and will not count it for you. This is one of the disparities about this active session of a thing, it's good we consider it.