egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

NTP Time TCL

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
VoodooServ
Voice


Joined: 27 Oct 2013
Posts: 7
Location: Bulgaria / Pleven

PostPosted: Sun Oct 27, 2013 1:16 pm    Post subject: NTP Time TCL Reply with quote

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
View user's profile Send private message Visit poster's website
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sun Nov 03, 2013 7:24 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
VoodooServ
Voice


Joined: 27 Oct 2013
Posts: 7
Location: Bulgaria / Pleven

PostPosted: Mon Nov 04, 2013 12:20 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Tue Nov 05, 2013 11:58 am    Post subject: Reply with quote

Time package is a part of TCLLIB.
For GMT add extra 2 hours to the current time (GMT +0)
Back to top
View user's profile Send private message Visit poster's website
VoodooServ
Voice


Joined: 27 Oct 2013
Posts: 7
Location: Bulgaria / Pleven

PostPosted: Mon Dec 09, 2013 2:51 pm    Post subject: Reply with quote

Now:
Code:
NTP couldn't open socket: host is unreachable


Please test.

how to fix ?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber