summaryrefslogtreecommitdiffstats
path: root/time.tcl
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2011-08-16 10:51:41 +0200
committerStefan Ritter <xeno@thehappy.de>2011-08-16 10:51:41 +0200
commitba46c304bdffdce0b6019a47f6759ce6abbeef90 (patch)
tree40a5b204637cb65c5bb91bd4f26a248ea498e019 /time.tcl
Initial commit
Diffstat (limited to 'time.tcl')
-rw-r--r--time.tcl26
1 files changed, 26 insertions, 0 deletions
diff --git a/time.tcl b/time.tcl
new file mode 100644
index 0000000..2fa82a5
--- /dev/null
+++ b/time.tcl
@@ -0,0 +1,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"