When my script announce a requested nick it shows the time when the nick was added to the db.txt file. In the db.txt file it is saved with the unixtime.
like:
!search nick
announce: <lastname> <frontname> was added on <addtime>
Is it posible to add someting to the script, so it shows how long ago the nick was added to the db.txt file?
someting like:
!search nick
announce: <lastname> <frontname> was added on <addtime> that was <## hours, ## minutes and ##> sec ago.
I dont know much about .tcl scripting, but I found the following lines in the script, that may help(?) :
Addnick:
Code: Select all
set timestamp [check:stamp [lindex $arg 2]]
set rlstmp [lindex $arg 0]
if { $rlstmp == "" } { putserv "NOTICE $nick : USAGE\: !addnick LASTNAME FRONTNAME UNXTiME "; return 0 }
annouce:
Code: Select all
set addtime [unx2nps $timestamp]
Code: Select all
proc check:stamp { timestamp } {
regsub -- {[nN][oO][wW]} $timestamp "" timestamp
if { $timestamp == "" || $timestamp == "\-" } { return [unixtime] } else { return $timestamp}
}
proc unx2nps { timestamp } {
if {[regexp "\[^\\d\]" $timestamp]} { error "unx2nps: parameter is not a valid unix timestamp" }
if {$timestamp > "2000000000"} { error "unx2nps: parameter is too large" }
return [clock format $timestamp -format "%Y/%m/%d %H:%M:%S"]
}