<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/17992" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2010-10-17T14:53:32-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/17992</id>

		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2010-10-17T14:53:32-04:00</updated>

		<published>2010-10-17T14:53:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94779#p94779</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94779#p94779"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94779#p94779"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>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\&amp;\':\,]+)} $page gotname show_name    set gotnext [ regexp {Next Episode@([0-9x]+)\^([A-Za-z0-9 -\`\"\'\&amp;:.,]+)\^([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\]"   }}</code></pre></div>Something like that eh? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>This is timezone independent. The script automatically adjusts your timezone to GMT. This will not work on FreeBSD (it will work on anything else), as there is a known issue with UTC timestamps given when UTC was not requested. There is a work-around for FreeBSD as well which is equally simple. This code is also tcl8.4 friendly so works on past/present/future bots as well.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Oct 17, 2010 2:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tigrato]]></name></author>
		<updated>2010-10-17T14:40:13-04:00</updated>

		<published>2010-10-17T14:40:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94778#p94778</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94778#p94778"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94778#p94778"><![CDATA[
I didn't get it working... <br><br><br>My script:<br><div class="codebox"><p>Code: </p><pre><code>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\&amp;\':\,]+)} $page gotname show_name    set gotnext [ regexp {Next Episode@([0-9x]+)\^([A-Za-z0-9 -\`\"\'\&amp;:.,]+)\^([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></pre></div>Someone can help?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10739">tigrato</a> — Sun Oct 17, 2010 2:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2010-10-17T13:28:13-04:00</updated>

		<published>2010-10-17T13:28:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94776#p94776</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94776#p94776"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94776#p94776"><![CDATA[
<blockquote class="uncited"><div>hi,<br><br>How can i add one hour? like this<br>Example: 6 days 5 hours 40 minutes 6 seconds from now <br>I need: 6 days <strong class="text-strong">6</strong> hours 40 minutes 6 seconds from now <br><br>i need time in UTC (GMT+1) and tvrage have in GMT+0</div></blockquote><div class="codebox"><p>Code: </p><pre><code>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></pre></div>This will convert your time to GMT. Use this type of logic to do math against tvrage instead of merely [clock seconds] or [unixtime]. It should do this by default. This sounds like a flaw within tvrage itself IMO. It fails to arrive at proper "durations until" because it isn't converting bot timestamps to GMT before comparing against the show's air time in GMT. Pretty simple to add using my code above. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Oct 17, 2010 1:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tigrato]]></name></author>
		<updated>2010-10-17T12:20:18-04:00</updated>

		<published>2010-10-17T12:20:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94774#p94774</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94774#p94774"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94774#p94774"><![CDATA[
hi,<br><br>How can i add one hour? like this<br>Example: 6 days 5 hours 40 minutes 6 seconds from now <br>I need: 6 days <strong class="text-strong">6</strong> hours 40 minutes 6 seconds from now <br><br>i need time in UTC (GMT+1) and tvrage have in GMT+0<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10739">tigrato</a> — Sun Oct 17, 2010 12:20 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tigrato]]></name></author>
		<updated>2010-09-09T18:05:47-04:00</updated>

		<published>2010-09-09T18:05:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94312#p94312</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94312#p94312"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94312#p94312"><![CDATA[
yes. Thanks everyone.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10739">tigrato</a> — Thu Sep 09, 2010 6:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2010-09-09T10:35:00-04:00</updated>

		<published>2010-09-09T10:35:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94304#p94304</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94304#p94304"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94304#p94304"><![CDATA[
<blockquote class="uncited"><div> [1 week 5 days from now] instead[ 1 week 5 days 13 hours 39 minutes 35 seconds from now]</div></blockquote>If I understood what you wanted it to do, then adding one line to doggo's oringal script will do it:<br><div class="codebox"><p>Code: </p><pre><code># original script here:  http://forum.egghelp.org/viewtopic.php?p=94273#94273bind pub - !test countdownproc countdown { nickname hostname handle channel arg } {#unixtime stamp for 09/08/2010 @ 17:00, 4 weeks backset 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]\)"               }</code></pre></div>Produces this in the channel:<br><br>&lt;botnick&gt; date1 was: 4 weeks 2 days ago, testnick | (09.08.2010 @ 12:00:00)<br><br><br>Is that it?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Thu Sep 09, 2010 10:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tigrato]]></name></author>
		<updated>2010-09-09T09:15:15-04:00</updated>

		<published>2010-09-09T09:15:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94302#p94302</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94302#p94302"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94302#p94302"><![CDATA[
doggo you dont understand sorry<br><br> [1 week 5 days from now] instead[ 1 week 5 days 13 hours 39 minutes 35 seconds from now]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10739">tigrato</a> — Thu Sep 09, 2010 9:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[doggo]]></name></author>
		<updated>2010-09-09T08:38:36-04:00</updated>

		<published>2010-09-09T08:38:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94300#p94300</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94300#p94300"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94300#p94300"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>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 "" thenregsub -all {week*s} $then "" thenregsub -all {day*s} $then "" thenregsub -all {hour*s} $then "" thenregsub -all {minute*s} $then "" thenregsub -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></pre></div><div class="codebox"><p>Code: </p><pre><code>[13:31] &lt;doggo&gt; !test[13:31] &lt;inner-SaNcTuM&gt; date1 was: 4  2  20  31  12 | (09.08.2010 @ 17:00:00))</code></pre></div>ive never wanted to remove them parts but that seems to work, also i dont know much about regsub if theres a simpler way id like to know too <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11046">doggo</a> — Thu Sep 09, 2010 8:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tigrato]]></name></author>
		<updated>2010-09-08T14:21:56-04:00</updated>

		<published>2010-09-08T14:21:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94278#p94278</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94278#p94278"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94278#p94278"><![CDATA[
Solved. But how to remove  the hours, minutes and seconds?<br><strong class="text-strong">6 days 5 hours 40 minutes 6 seconds from now </strong><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10739">tigrato</a> — Wed Sep 08, 2010 2:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[doggo]]></name></author>
		<updated>2010-09-08T11:34:17-04:00</updated>

		<published>2010-09-08T11:34:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94273#p94273</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94273#p94273"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94273#p94273"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - !test countdownproc countdown { nickname hostname handle channel arg } {#unixtime stamp for 09/08/2010 @ 17:00, 4 weeks backset date1 "1281369600" # finds the time and date now        set now [unixtime] # counts the time passed scince nowincr now -$date1 # shows how long has passed since $date1set 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></pre></div>this is just an example explaining how to do what i think you mean, with unixtime timestamps<br><br>output to channel <br><div class="codebox"><p>Code: </p><pre><code> [16:21] &lt;doggo&gt; !test[16:21] &lt;inner-SaNcTuM&gt; date1 was: 4 weeks 1 day 23 hours 21 minutes 49 seconds ago, doggo | (09.08.2010 @ 17:00:00)</code></pre></div><br>hope this helps you figure something out <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11046">doggo</a> — Wed Sep 08, 2010 11:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[blake]]></name></author>
		<updated>2010-09-08T10:40:40-04:00</updated>

		<published>2010-09-08T10:40:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94268#p94268</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94268#p94268"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94268#p94268"><![CDATA[
Check out the countdown scripts in the tcl archives they could do what you want try date.tcl<br><br><a href="http://www.egghelp.org/tclhtml/3478-4-0-0-1-countdown.htm" class="postlink">http://www.egghelp.org/tclhtml/3478-4-0 ... ntdown.htm</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10512">blake</a> — Wed Sep 08, 2010 10:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tigrato]]></name></author>
		<updated>2010-09-08T08:48:34-04:00</updated>

		<published>2010-09-08T08:48:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94266#p94266</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94266#p94266"/>
		<title type="html"><![CDATA[Script show time left between two dates]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94266#p94266"><![CDATA[
I wanted a code that would make the subtraction between two dates using tv a script. <br>The next episode of Sons of Anarchy is Oiled[S03E02], it airs on 2010-09-14 [<span style="color:red"><strong class="text-strong">6 days from now</strong></span><strong class="text-strong">]</strong><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10739">tigrato</a> — Wed Sep 08, 2010 8:48 am</p><hr />
]]></content>
	</entry>
	</feed>
