Watchmaker Wiki

The ultimate watch maker for Android Wear!

User Tools

Site Tools


tips:refresh_age

Calculate Time since last refresh

Since the {wlu} tag is in 24 hr format we need to do some manipulation to figure out how long ago the last refresh occurred.

Example

('{dh23}'=='0' and (string.sub('{wlu}',1,2)=='23')) and (string.sub('Updated ',1,8))..(({dm}+60)-(string.sub('{wlu}',4,5)))..' min ago' or'{dh23z}' > (string.sub('{wlu}',1,2)) and (string.sub('Updated ',1,8))..(({DM}+60) - (string.sub('{wlu}',4,5)))..' min ago' or(string.sub('Updated ',1,8)..{DM} - (string.sub('{wlu}',4,5)))..' min ago'

Explanation

By using this formula in the text field we are comparing the current hour (00-23) to the hour of the last refresh.

If the current hour is greater then we add 60 to the current minute and subtract the last refresh minutes value.

If the hours are the same we simply subtract the last refresh minutes from the current minutes.

For 12am, we check if the current hour is 00 and if the last refresh hour is 23 and if so make the current hour 24 to do our math.

tips/refresh_age.txt · Last modified: 2018/01/26 19:25 by toby_goodlock