int absolute_period_requested = -1;
time_t first_entry_t = rrdset_first_entry_t(st);
- time_t last_entry_t = rrdset_last_entry_t(st);
+ time_t last_entry_t = rrdset_last_entry_t(st);
if(before == 0 && after == 0) {
before = last_entry_t;
}
// allow relative for before and after
- if(before <= st->update_every * st->entries) {
+ if(((before < 0)?-before:before) <= (st->update_every * st->entries)) {
before = last_entry_t + before;
absolute_period_requested = 0;
}
- if(after <= st->update_every * st->entries) {
- after = last_entry_t + after;
+ if(((after < 0)?-after:after) <= (st->update_every * st->entries)) {
+ if(after == 0) after = -st->update_every;
+ after = before + after;
absolute_period_requested = 0;
}
allowEmptyValue: false
- name: after
in: query
- description: 'This parameter can either be an absolute timestamp specifying the starting point of the data to be returned, or a relative number of seconds, to the last collected timestamp. Netdata will assume it is a relative number if it is smaller than the duration of the round robin database for this chart. So, if the round robin database is 3600 seconds, any value from -3600 to 3600 will trigger relative arithmetics. Netdata will adapt this parameter to the boundaries of the round robin database.'
+ description: 'This parameter can either be an absolute timestamp specifying the starting point of the data to be returned, or a relative number of seconds (relative to parameter: before). Netdata will assume it is a relative number if it is smaller than the duration of the round robin database for this chart. So, if the round robin database is 3600 seconds, any value from -3600 to 3600 will trigger relative arithmetics. Netdata will adapt this parameter to the boundaries of the round robin database.'
required: true
type: number
format: integer