|
|
|
|
|
by informatimago
4686 days ago
|
|
The last hour now goes back from 22:45:03.435123897 (remember, nanosecond timer, but now it is from 22:46:07.223981453. Unless you can round the time when the last second, the last minute, etc start, you have to keep the full history of increment events up to the nanosecond for the last 24 hours. That's O(246060*1e9). |
|
It's a lovely exercise in algorithm tradeoffs. In this case it's mainly accuracy vs. memory, with lots of opportunity to explore implementation optimizations.