4 ms·
My reading of the API is that getCountInLastSecond returns the count from the last billion nanoseconds, not the count from the previous second bucket (as the cl
by scotth 13y ago
My reading of the API is that getCountInLastSecond returns the count from the last billion nanoseconds, not the count from the previous second bucket (as the clock ticks).
So when he mentions he can't bound memory, it's because he can't easily discretize the counters.
- rlpb 13y agoI feel that this is an important ambiguity. When I read the article, my first question was whether this interpretation is correct, or the other one. I am surprised that he didn't clarify this in the article, and wonder if this is a problem. Seeing ambiguities in specifications is an important part of software engineering.
- scotth 13y agoI think you're right. Note taken.
- reikonomusha 13y agoThis is the correct interpretation. Imagine an infinite time line, with a marker moving across the line at the speed of time. Every time increment is called, that marker is saved on the timeline. When getCountInLastX is called, one must return the number of marks on the timeline from the current time to the current time minus X.
- guard-of-terra 13y agoThen you also need to carry a second-worth of timestamps in a queue.