| View previous topic :: View next topic |
| Author |
Message |
VoodooServ Voice
Joined: 27 Oct 2013 Posts: 7 Location: Bulgaria / Pleven
|
Posted: Sun Oct 27, 2013 1:16 pm Post subject: NTP Time TCL |
|
|
Hi. Can write TCL script in command: !time ot !ntp bot telling time directly from a specific NTP server.
for example:
User: !ntp
Bot: NTP pool.ntp.org time: 09:45:63 GMT+2 |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Sun Nov 03, 2013 7:24 am Post subject: |
|
|
| Code: | # Author: tomekk
# e-mail: tomekk/@/tomekk/./org
# home page: http://tomekk.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
set server "pool.ntp.org"
###########################################################
bind pub - !ntp gimme_time
package require time
proc gimme_time { nick uhost hand chan arg } {
global server
set tok [time::getsntp $server]
time::wait $tok
if {[time::status $tok] eq "ok"} {
set t [time::unixtime $tok]
putquick "PRIVMSG $chan :NTP $server time: [clock format $t -format "%H:%M:%S"]"
} else {
putquick "PRIVMSG $chan :NTP [time::error $tok]"
}
time::cleanup $tok
}
putlog "ntp.tcl ver 0.1 by tomekk loaded" |
check it.... its kinda old...
GMT calculation .. do it at your own |
|
| Back to top |
|
 |
VoodooServ Voice
Joined: 27 Oct 2013 Posts: 7 Location: Bulgaria / Pleven
|
Posted: Mon Nov 04, 2013 12:20 pm Post subject: |
|
|
Thanks for script.
How to config for GMT+2 ?
I can't find package time .
| Code: |
can't find package time
while executing
"package require time"
(file "scripts/ntp.tcl" line 12)
invoked from within
"source scripts/ntp.tcl"
(file "eggdrop.conf" line 1396)
* CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
|
|
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Tue Nov 05, 2013 11:58 am Post subject: |
|
|
Time package is a part of TCLLIB.
For GMT add extra 2 hours to the current time (GMT +0) |
|
| Back to top |
|
 |
VoodooServ Voice
Joined: 27 Oct 2013 Posts: 7 Location: Bulgaria / Pleven
|
Posted: Mon Dec 09, 2013 2:51 pm Post subject: |
|
|
Now:
| Code: | | NTP couldn't open socket: host is unreachable |
Please test.
how to fix ? |
|
| Back to top |
|
 |
|