I’m trying to calculate the time difference between latest and previous update of an item. Using jdbc as persistence.
I cant understand why this doesn’t work, Why is the timestamp for lastUpdate and previusState the same?
var timeLast = triggeringItem.lastUpdate("jdbc")
var timePrevius = triggeringItem.previousState(true, "jdbc").timestamp
logInfo("Energy","timeLast : {}", timeLast)
logInfo("Energy","timePrevius : {}", timePrevius)
Log
2022-12-02 21:58:36.236 [INFO ] [org.openhab.core.model.script.Energy] - timeLast : 2022-12-02T21:58:26.152+01:00[Europe/Berlin]
2022-12-02 21:58:36.240 [INFO ] [org.openhab.core.model.script.Energy] - timePrevius : 2022-12-02T21:58:26.152+01:00[Europe/Berlin]
2022-12-02 21:59:16.231 [INFO ] [org.openhab.core.model.script.Energy] - timeLast : 2022-12-02T21:59:16.145+01:00[Europe/Berlin]
2022-12-02 21:59:16.233 [INFO ] [org.openhab.core.model.script.Energy] - timePrevius : 2022-12-02T21:59:16.145+01:00[Europe/Berlin]