well the timestaps tell you the number of seconds since jan 1st (midnight) 1970 - so if you subtract the one from the other, that will tell you how many seconds there were inbetween the "coming to the site" and "leaving the site", hence the number of seconds spent at the site.
therefore:
$activity[seconds] = $userinfo[lastactivity] - $userinfo[lastvisit];
then you can use that to work out everything else:
$activity[minutes] = $activity[seconds] / 60 ;
$activity[hours] = $activity[seconds] / 3600;
of course each of these will give you big remainders too, but i guess youcould do something like $activity[minutes] = split(".", $activity[minutes]; to break it up - i wouldnt have thought it will take you too long to come up with something, but if i can think of it i'll post it here.