- void getBucketInfo(TimeType time, size_t* bucketIdx,
- TimeType* bucketStart, TimeType* nextBucketStart) const;
+ void getBucketInfo(
+ TimePoint time,
+ size_t* bucketIdx,
+ TimePoint* bucketStart,
+ TimePoint* nextBucketStart) const;
+
+ /*
+ * Legacy APIs that accept a Duration parameters rather than TimePoint.
+ *
+ * These treat the Duration as relative to the clock epoch.
+ * Prefer using the correct TimePoint-based APIs instead. These APIs will
+ * eventually be deprecated and removed.
+ */
+ bool addValue(Duration now, const ValueType& val) {
+ return addValueAggregated(TimePoint(now), val, 1);
+ }
+ bool addValue(Duration now, const ValueType& val, int64_t times) {
+ return addValueAggregated(TimePoint(now), val * times, times);
+ }
+ bool
+ addValueAggregated(Duration now, const ValueType& total, int64_t nsamples) {
+ return addValueAggregated(TimePoint(now), total, nsamples);
+ }
+ size_t update(Duration now) {
+ return update(TimePoint(now));
+ }