Fixed uptime counting. (It didn't work, if uptime lapped over several periods.)