summaryrefslogtreecommitdiffstats
path: root/time.tcl
blob: 2fa82a5a1f36aa54070ea516b5fa6dd6de28d3c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# slap by lookshe
#package require time

bind pub - !zeit proc_time
bind pub - !time proc_time

proc proc_time {nick host hand chan opfer} {
   #putserv "PRIVMSG $chan :[clock format [NetTime ntp.nasa.gov]]"
   putserv "PRIVMSG $chan :[exec date]"
}

proc NetTime {server} {
   set tok [time::getsntp $server] ;# or gettime to use the TIME protocol
    time::wait $tok
    if {[time::status $tok] eq "ok"} {
       set result [time::unixtime $tok]
       set code ok
    } else {
       set result [time::error $tok]
       set code error
    }
    time::cleanup $tok
    return -code $code $result
}

putlog "time by lookshe loaded"