You could enter the time in the database when the page was requested and again when the next page is requested in the same session.
However, that would leave you with the problem that a user can use 2 browser-windows for the same session.
Also, a user could be doing something completely different while the page is open, like having a cup of coffee in the next room, hmmm, good idea :P
the latter problem you will probably have with every solution.
It also comes to my mind how usefull the data would be since the data is very likely not to be accurate!! (see above reasons).