# HG changeset patch # User Matti Hamalainen # Date 1449868384 -7200 # Node ID b1e7ffeaacef39fe602e9053707d397fb25c0779 # Parent 0de6e0c2c89cb9d755ed40a1331398904668f379 weather: Adjust time output handling. diff -r 0de6e0c2c89c -r b1e7ffeaacef weather.tcl --- a/weather.tcl Fri Dec 11 22:54:26 2015 +0200 +++ b/weather.tcl Fri Dec 11 23:13:04 2015 +0200 @@ -77,11 +77,6 @@ } -proc weather_ctime {utime} { - return [clock format $utime -format "%H:%M"] -} - - proc weather_valid_user {uhand} { if {$uhand != "" && $uhand != "{}" && $uhand != "*"} { return 1 @@ -149,7 +144,13 @@ set uvals(station) [lindex $udata 0] set uvals(type) [lindex $udata 1] set uvals(vtime) [lindex $udata 2] - set uvals(ctime) [weather_ctime [lindex $udata 2]] + set utime_d [expr [clock seconds] - $uvals(vtime)] + if {$utime_d < 3600} { + set uvals(ctime) [clock format $uvals(vtime) -format "%H:%M"] + } else { + set uvals(ctime) [clock format $uvals(vtime) -format "%H:%M (%D)"] + } + set uvals(temp) [lindex $udata 3] if {[lindex $udata 1] == 0} { @@ -164,6 +165,9 @@ # Transform the format list set astr "" + if {$utime_d >= 3600} { + set astr "** " + } foreach aitem $weather_msg_result { set atmp $aitem foreach {akey aval} [array get uvals] {