Watchmaker Wiki

The ultimate watch maker for Android Wear!

User Tools

Site Tools


tips:refresh_age

This is an old revision of the document!


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

(('{dh23z}'=='00') 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 (1-24) to the hour of the last refresh. We use {dh24} instead of {dh23} because in the case of 12am comparing to 11pm we would use the values 24 > 23.

This is with the assumption that you are using 12 hour or 24 hour (0-23) formatting for your time.

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.

tips/refresh_age.1515679999.txt.gz · Last modified: 2018/01/11 14:13 by toby_goodlock