Problem description: If function timeleft() is used in timeshift in a trigger expression, or in a calculated item formula, then this timeshift parameter is only taken into account when selecting the data for calculation, but the calculation itself is made from current time.
In this case, if the time left to reach the threshold is smaller than the timeshift parameter value, then the formula would return the maximal allowed value, as if the threshold has already been reached.
In my opinion, to correctly describe the tendency, the moment from which the calculation is made should also take into account the timeshift parameter.
Steps to reproduce:
- Create host "test"
- Create a trapper item is key "trap" for this host
- Create a calculated item with formula timeleft("test:trap",#5,30s,10)
- Send values from 0 to 6 to this trapper within 10 seconds period
- Open calculated item configuration and press "Test" button
- Wait for 30 seconds
- In the opened "Test item" dialogue click "Get value and test"
Result 1: the maximal possible value is returned by the Test item dialogue, as if the threshold "10" has already been reached.
- Change the threshold in the formula to "100" and repeat steps 4-7
Result 2: The value returned in the Test item overlay dialogue indicates that calculation is made from the current moment and the timeshift parameter is not taken into account during calculation.
Expected: if Timeshift parameter is set then the timeleft() calculation should be made from "now()-timeshift" moment and not from current time.