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.
You are right, it all depends on how active the person is, the activity however is too technical to calculate, which is where many might be making mistakes. I read through what others have narrated and I realized that there are slight differences in response to how this activity is being calculated. The only thing that is sure is that once you are active, then the counter continues to accord that for you. I mean refreshing and surfing the forum actively, not just typing.
The counter might also stop counting in a situation as shown above despite the person is still active on the webpage. This often happens to me mostly when I have a lot to type.