I am currently synchronize Portage tree with weekly basis. I used to show the timestamp (/usr/portage/metadata/timestamp.chk) directly in Conky and synchronize when it’s been more than 24 hours. I want to have a easy way to know if I should update. So, I wrote:

${color lightblue}Portage:$color ${execpi 600 thres=$((7*24*60*60));ts="$(cat /usr/portage/metadata/timestamp.chk)";dur=$(($(date +%s) - $(date -d "$ts" +%s)));((dur>=thres)) && echo $(date -d "$ts" +%F\ %T) || echo "\${execbar echo $((100*dur/thres))}"}

The command is:

thres=$((7*24*60*60))
ts="$(cat /usr/portage/metadata/timestamp.chk)"
dur=$(($(date +%s) - $(date -d "$ts" +%s)))
((dur>=thres))
  && echo $(date -d "$ts" +%F\ %T)
  || echo "\${execbar echo $((100*dur/thres))}"

It calculates the seconds since last update. If it’s been seven days, then it shows the time of last update, otherwise a conky execbar for showing how far away from seven days.