@@ -3848,8 +3848,9 @@ static int wg_rebase_item(
3848
3848
// element is sufficient.
3849
3849
int ds_type = payload -> values [0 ].ds_type ;
3850
3850
3851
- // If any of the counters have wrapped, then we need to reset the tracker
3852
- // baseline and start_time.
3851
+ // Check to see if any of the counter values have decreased from their last
3852
+ // recorded value (indicating an overflow wrap or a reset). If so, reset the
3853
+ // tracker baseline and start_time for all values within this payload.
3853
3854
int some_counter_wrapped = 0 ;
3854
3855
for (i = 0 ; i < payload -> num_values ; ++ i ) {
3855
3856
if (wg_value_less (ds_type , & payload -> values [i ].val ,
@@ -3859,9 +3860,12 @@ static int wg_rebase_item(
3859
3860
}
3860
3861
}
3861
3862
3862
- // If any counter wrapped, everybody resets.
3863
3863
if (some_counter_wrapped ) {
3864
- tracker -> start_time = payload -> start_time ;
3864
+ // Set the reset timestamp to be one millisecond before the timestamp of the
3865
+ // current point. We don't know the true reset time but this ensures the
3866
+ // range is non-zero while unlikely to conflict with any previous point.
3867
+ tracker -> start_time =
3868
+ NS_TO_CDTIME_T (CDTIME_T_TO_NS (payload -> start_time ) - 1000000 );
3865
3869
for (i = 0 ; i < payload -> num_values ; ++ i ) {
3866
3870
wg_value_set_zero (ds_type , & tracker -> baselines [i ]);
3867
3871
}
0 commit comments