Code: Select all
bind pub - !test countdown
proc countdown { nickname hostname handle channel arg } {
#unixtime stamp for 09/08/2010 @ 17:00, 4 weeks back
set date1 "1281369600"
# finds the time and date now
set now [unixtime]
# counts the time passed scince now
incr now -$date1
# shows how long has passed since $date1
set then [duration $now]
puthelp "PRIVMSG $channel :date1 was: $then ago, $nickname | \([clock format $date1 -format %d.%m.%Y] @ [clock format $date1 -format %H:%M:%S]\)"
}
Code: Select all
[16:21] <doggo> !test
[16:21] <inner-SaNcTuM> date1 was: 4 weeks 1 day 23 hours 21 minutes 49 seconds ago, doggo | (09.08.2010 @ 17:00:00)
Code: Select all
proc countdown { nickname hostname handle channel arg } {
set date1 "1281369600"
set now [unixtime]
incr now -$date1
set then [duration $now]
regsub -all {year*s} $then "" then
regsub -all {week*s} $then "" then
regsub -all {day*s} $then "" then
regsub -all {hour*s} $then "" then
regsub -all {minute*s} $then "" then
regsub -all {second*s} $then "" then
puthelp "PRIVMSG $channel :date1 was: $then | \([clock format $date1 -format %d.%m.%Y] @ [clock format $date1 -format %H:%M:%S]\)"
}
Code: Select all
[13:31] <doggo> !test
[13:31] <inner-SaNcTuM> date1 was: 4 2 20 31 12 | (09.08.2010 @ 17:00:00))
If I understood what you wanted it to do, then adding one line to doggo's oringal script will do it:tigrato wrote: [1 week 5 days from now] instead[ 1 week 5 days 13 hours 39 minutes 35 seconds from now]
Code: Select all
# original script here: http://forum.egghelp.org/viewtopic.php?p=94273#94273
bind pub - !test countdown
proc countdown { nickname hostname handle channel arg } {
#unixtime stamp for 09/08/2010 @ 17:00, 4 weeks back
set date1 "1281369600"
# finds the time and date now
set now [unixtime]
# counts the time passed scince now
incr now -$date1
# shows how long has passed since $date1
set then [duration $now]
set then "[lrange [split $then] 0 3]"
puthelp "PRIVMSG $channel :date1 was: $then ago, $nickname | \([clock format $date1 -format %d.%m.%Y] @ [clock format $date1 -format %H:%M:%S]\)"
}
tigrato wrote:hi,
How can i add one hour? like this
Example: 6 days 5 hours 40 minutes 6 seconds from now
I need: 6 days 6 hours 40 minutes 6 seconds from now
i need time in UTC (GMT+1) and tvrage have in GMT+0
Code: Select all
set my_time_in_gmt [clock scan [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S %Z"] -gmt 1]]
set time_til_airs [duration [expr {$time_show_airs - $my_time_in_gmt}]]
Code: Select all
proc dlx:tvrage:next { nick host hand chan arg } {
global tvrage
package require http
set arg [string map { " " "_" } $arg]
set url "http://services.tvrage.com/tools/quickinfo.php?show=$arg"
set page [http::data [http::geturl $url -timeout $tvrage(timeout)]]
regexp {Show Name@([A-Za-z 0-9\&\':\,]+)} $page gotname show_name
set gotnext [ regexp {Next Episode@([0-9x]+)\^([A-Za-z0-9 -\`\"\'\&:.,]+)\^([A-Za-z0-9/]+)/([0-9]+)/([0-9]+)} $page gotnext next_ep next_ep_title next_ep_date1 next_ep_date2 next_ep_date3]
set gotunix1 [ regexp {NODST@([0-9]+)} $page gotunix gotunix2 ]
regexp {Airtime@([A-Za-z, 0-9:]+)} $page gotairtime show_airtime
if { ![info exists show_name] } {
putquick "PRIVMSG $chan :Error! (timeout or something similar)"
# return -1
}
if { $gotnext == 0 } {
putquick "PRIVMSG $chan :The next episode of \002$show_name\002 is not yet scheduled."
} else {
set now [unixtime]
incr gotunix2 -$now
set timeleft [duration $gotunix2]
putquick "PRIVMSG $chan :The next episode of \002$show_name\002 is \002$next_ep_title \[$next_ep\]\002, it will air on \002$next_ep_date2-$next_ep_date1-$next_ep_date3\002 \[\002$timeleft from now\002\]"
}
}
Code: Select all
proc dlx:tvrage:next { nick host hand chan arg } {
global tvrage
package require http
set arg [string map { " " "_" } $arg]
set url "http://services.tvrage.com/tools/quickinfo.php?show=[http::formatQuery $arg]"
set page [http::data [set token [http::geturl $url -timeout $tvrage(timeout)]]]
::http::cleanup $token
regexp {Show Name@([A-Za-z 0-9\&\':\,]+)} $page gotname show_name
set gotnext [ regexp {Next Episode@([0-9x]+)\^([A-Za-z0-9 -\`\"\'\&:.,]+)\^([A-Za-z0-9/]+)/([0-9]+)/([0-9]+)} $page gotnext next_ep next_ep_title next_ep_date1 next_ep_date2 next_ep_date3]
set gotunix1 [ regexp {NODST@([0-9]+)} $page gotunix gotunix2 ]
regexp {Airtime@([A-Za-z, 0-9:]+)} $page gotairtime show_airtime
if { ![info exists show_name] } {
putquick "PRIVMSG $chan :Error! (timeout or something similar)"
# return -1
}
if { $gotnext == 0 } {
putquick "PRIVMSG $chan :The next episode of \002$show_name\002 is not yet scheduled."
} else {
# get a clean unix timestamp in GMT
set now [clock scan [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S %Z"] -gmt 1]]
# compare GMT timestamps, remove hours,minutes,seconds
# generate duration until.
set timeleft [duration [expr {($gotunix2 - $now) - (($gotunix2 - $now) % 86400)}]]
putquick "PRIVMSG $chan :The next episode of \002$show_name\002 is \002$next_ep_title \[$next_ep\]\002, it will air on \002$next_ep_date2-$next_ep_date1-$next_ep_date3\002 \[\002$timeleft from now\002\]"
}
}