This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Unix time

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Getodacul
Voice
Posts: 20
Joined: Thu Jun 07, 2007 2:32 pm

Unix time

Post by Getodacul »

Mon Dec 10 14:24:31 2007 = 1197289471 in unix time . How i must calculate to find a random date? (ex. 30/08/2008 )
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

with the [clock scan] cmd?

http://www.tcl.tk/man/tcl8.4/TclCmd/clock.htm

You weren't very clear in your request..
User avatar
Getodacul
Voice
Posts: 20
Joined: Thu Jun 07, 2007 2:32 pm

Post by Getodacul »

This date Mon Dec 10 14:24:31 2007 it's converted to 1197289471 by my eggdrop. And it's not a random number. I think that's unix time.
I will put the script here:
####################################################
# What is the minimum access someone needs check ontime?
set ontime(acc) "-|-"
####################################################

bind pub $ontime(acc) "!ontime" ontime:nick

proc ontime:nick { nickname hostname handle channel arguments } {
global ontime
set nickname [lindex [split $arguments] 0]
if {$nickname == ""} {
putquick "PRIVMSG $channel :I need a nick to check it."
return 0
}
if {[string length $nickname] >= "16"} {
putquick "PRIVMSG $channel :Nickname too long."; return
}
putquick "whois $nickname $nickname"
set ::ontimechannel $channel
set ::ontimenickname $nickname
bind RAW - 401 ontime:nosuch
bind RAW - 317 ontime:idle
}

proc ontime:putmsg { channel arguments } {
putquick "PRIVMSG $channel :$arguments"
}

proc ontime:nosuch { from keyword arguments } {
set channel $::ontimechannel
set nickname $::ontimenickname
ontime:putmsg $channel "No such nickname \"$nickname\""
unbind RAW - 401 ontime:nosuch
}

proc ontime:idle { from keyword arguments } {
set channel $::ontimechannel
set nickname $::ontimenickname
set idletime [lindex [split $arguments] 2]
set signon [lindex [split $arguments] 3]
ontime:putmsg $channel "$nickname has been idle for [duration $idletime], signed on [ctime $signon]"
if {$signon >= "1196691738"} {
putserv "PRIVMSG $channel :$nickname have NOT big uptime and deserve flowers."
} else {
putserv "MODE $channel +v $nickname"
putserv "PRIVMSG $channel :$nickname have big uptime and deserve voice. $signon"
}
unbind RAW - 317 ontime:idle
}

putlog "Public ontime script Loaded"
This code it's inspired by a part of whois.tcl by MeTroiD
I need to control somehow $signon variable.
1196691738 from the script = Mon Dec 3 16:22:18 2007
User avatar
Getodacul
Voice
Posts: 20
Joined: Thu Jun 07, 2007 2:32 pm

Post by Getodacul »

If i will know how to control that variable i will try to make a top N uptime script (based on signon time).
Post Reply