#11pm GMT #by kano for fungiside alias swatch chk_swatch proc chk_swatch {} { set ans "" while {$ans == "" || [catch {expr 0+$ans}]} { set ans [lindex [FALC_listbox -t "swatch addon" -m "enter your time zone" -e [list "-5 (est)" "-6 (cst)" "-8 (pst)"]] 0] } set_cookie swatch_tz $ans catch complete } if {[get_cookie swatch_tz] == ""} { chk_swatch } alias sb { if {[arg] == "say"} { set s say;set p "" } { set s echo;set p "[kano] " } $s "${p}The time is @[unix2sb] (www.swatch.com)" complete } proc unix2swatch {{time time}} { if {$time == "time"} {set time [clock seconds]} set time [expr $time-[clock scan [clock format $time -format %m/%d/%y]]] return [expr ($time-(([get_cookie swatch_tz]-1)*3600)) %86400] } proc unix2sb {{time time}} { if {$time == "time"} {set time [clock seconds]} set time [expr round(([unix2swatch $time]/86400.0)*1000)] set t 00$time set len [string length $t] return [string range $t [expr $len-3] end] } set lastsb [window get_title main] set lastbeat [unix2sb] rename window sb_win proc window args { global lastsb if {[lindex $args 0] == "set_title" && [lindex $args 2] == "main"} { sb_win set_title [concat [lindex $args 1] @[unix2sb]] main set lastsb [lindex $args 1] } { if ![catch [concat sb_win $args] x] { return $x } { global errorInfo error $errorInfo } } } proc do_sb {} { global lastsb lastbeat set sb [unix2sb] if {$lastbeat != $sb} { window set_title $lastsb main set lastbeat $sb } } on timer do_sb proc tclprec {{x ""}} { global old_tclprec tcl_precision if {$x == ""} { set tcl_precision $old_tclprec } { set old_tclprec $tcl_precision set tcl_precision $x } return {} } #after 1 {set old_tclprec $tcl_precision} #on timer {set curtheme(backform) [rep $curtheme(backform) %gone {[tclprec 3][expr $g/86400.0*1000][tclprec]}]} kaddhelp swatch "Sets your timezone for the Swatch Internet Time addon." /tz "Swatch Timezone Set" /sb kaddhelp sb "Echoes or says the current Swatch Internet Time." "/sb \[say\]" "Display Swatch Internet Time" /swatch addecho "[kano] the time is @[unix2sb]"