<?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/11892" />

	<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>2006-05-29T04:38:36-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Slightz]]></name></author>
		<updated>2006-05-29T04:37:13-04:00</updated>

		<published>2006-05-29T04:37:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63521#p63521</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63521#p63521"/>
		<title type="html"><![CDATA[duraiton help [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63521#p63521"><![CDATA[
thanks  noname that works perfectly does that i needed<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7761">Slightz</a> — Mon May 29, 2006 4:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[noname]]></name></author>
		<updated>2006-05-28T15:49:38-04:00</updated>

		<published>2006-05-28T15:49:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63510#p63510</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63510#p63510"/>
		<title type="html"><![CDATA[duraiton help [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63510#p63510"><![CDATA[
<blockquote class="uncited"><div>try clock scan</div></blockquote>try sentence<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7805">noname</a> — Sun May 28, 2006 3:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2006-05-28T12:04:03-04:00</updated>

		<published>2006-05-28T12:04:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63503#p63503</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63503#p63503"/>
		<title type="html"><![CDATA[duraiton help [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63503#p63503"><![CDATA[
try clock scan<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Sun May 28, 2006 12:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[noname]]></name></author>
		<updated>2006-05-28T10:30:55-04:00</updated>

		<published>2006-05-28T10:30:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63500#p63500</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63500#p63500"/>
		<title type="html"><![CDATA[duraiton help [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63500#p63500"><![CDATA[
<blockquote class="uncited"><div>If you dont want duration to show more than 2 units, you could cut off the rest by using:<br>lrange [duration $d] 0 3<br>this should cut '1 week 2 days 7 hours 30 minutes' to '1 week 2 days'. No need to write an own proc about it :D.</div></blockquote>i just wanted to have days - no years or weeks<br>it should cut '1 week 2 days 7 hours 30 minutes' to '9 days 7 hours 30 minutes' ;)<br><br><blockquote class="uncited"><div>PS: why use a regexp "\[^\\d\]" if you can use a non regexp expression like (though this matchs rather {^\s*\d+\s*$}):<br>![string is integer -strict $timestamp]<br>Differences: your regexp continues if string is zero. 'string is' is valid when the value is trailed or lead by whitespace characters and therefore more accurate for TCL to determine, if a following integer operation will succeed.</div></blockquote>tnx a lot - mayb 'string is' was a bit to easy -.^<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7805">noname</a> — Sun May 28, 2006 10:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2006-05-28T06:54:08-04:00</updated>

		<published>2006-05-28T06:54:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63496#p63496</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63496#p63496"/>
		<title type="html"><![CDATA[duraiton help [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63496#p63496"><![CDATA[
If you dont want duration to show more than 2 units, you could cut off the rest by using:<br>lrange [duration $d] 0 3<br>this should cut '1 week 2 days 7 hours 30 minutes' to '1 week 2 days'. No need to write an own proc about it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy">.<br><br>PS: why use a regexp "\[^\\d\]" if you can use a non regexp expression like (though this matchs rather {^\s*\d+\s*$}):<br>![string is integer -strict $timestamp]<br>Differences: your regexp continues if string is zero. 'string is' is valid when the value is trailed or lead by whitespace characters and therefore more accurate for TCL to determine, if a following integer operation will succeed.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Sun May 28, 2006 6:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[noname]]></name></author>
		<updated>2006-05-27T16:48:41-04:00</updated>

		<published>2006-05-27T16:48:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63479#p63479</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63479#p63479"/>
		<title type="html"><![CDATA[duraiton help [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63479#p63479"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set prestamp_ago [duration [expr [unixtime] - $prestamp]]; # e.g. 4 years 37 weeks 2 days 18 hours 48 minutes 58 secondsset prestamp_day [clock format $prestamp -format "%m/%d"]; # e.g. 05/27</code></pre></div><br><br>but duration isnt the best method imho... noone wants to calc 1y 33weeks too days... so i here is my code, which i'm usin...<br><div class="codebox"><p>Code: </p><pre><code>### dupecheck[...]    set nothetime [unixtime]    set tim_ago [no:dupe:ago $nothetime $tim]; #e.g. 20d 7h 13m 16s    set tim_day [no:dupe:day $tim]; # e.g. 05/07[...]### dupe tim agoproc no:dupe:ago { unixtime prestamp } { if {[regexp "\[^\\d\]" $unixtime] != "1" &amp;&amp; [regexp "\[^\\d\]" $prestamp] != "1" &amp;&amp; $unixtime &lt; "2000000000" &amp;&amp; $prestamp &lt; "2000000000" &amp;&amp; $unixtime != "0" &amp;&amp; $prestamp != "0"} {   set timdiff [expr $unixtime - $prestamp]   set d [expr {$timdiff/86400}]  set h [expr {($timdiff%86400)/3600}]  set m [expr {(($timdiff%86400)%3600)/60}]  set s [expr {(($timdiff%86400)%3600)%60}]  append ds $d "d"  append hs $h "h"  append ms $m "m"  append ss $s "s"  if { $d &gt; 0 } {   append dupeago $ds " " $hs " " $ms " " $ss  } elseif { $h &gt; 0 } {   append dupeago $hs " " $ms " " $ss  } elseif { $m &gt; 0 } {   append dupeago $ms " " $ss  } else {   append dupeago $ss  }  return $dupeago }}### dupe day agoproc no:dupe:day { prestamp } { if {[regexp "\[^\\d\]" $prestamp] != "1" &amp;&amp; $prestamp &lt; "2000000000" &amp;&amp; $prestamp != "0" &amp;&amp; $prestamp != "0"} {   return  [clock format $prestamp -format "%m/%d"] }}</code></pre></div><br><br>btw: a new version will b published in a few days -.^<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7805">noname</a> — Sat May 27, 2006 4:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Slightz]]></name></author>
		<updated>2006-05-23T23:53:01-04:00</updated>

		<published>2006-05-23T23:53:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63328#p63328</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63328#p63328"/>
		<title type="html"><![CDATA[duraiton help [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63328#p63328"><![CDATA[
i haved... read and just got to change the format from 24 horus to PM AM but i dont get it how can i tweak that pice of code or how can i do it<br><br>can you help me out<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7761">Slightz</a> — Tue May 23, 2006 11:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2006-05-23T22:07:35-04:00</updated>

		<published>2006-05-23T22:07:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63321#p63321</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63321#p63321"/>
		<title type="html"><![CDATA[duraiton help [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63321#p63321"><![CDATA[
From tcl-commands.doc:<blockquote class="uncited"><div>  duration &lt;seconds&gt;<br>    Returns: the number of seconds converted into years, weeks, days, hours,<br>      minutes, and seconds. 804600 seconds is turned into 1 week 2 days<br>      7 hours 30 minutes.</div></blockquote>You may also find the <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/clock.htm" class="postlink">clock manual page</a> of use.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Tue May 23, 2006 10:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Slightz]]></name></author>
		<updated>2006-05-29T04:38:36-04:00</updated>

		<published>2006-05-23T20:32:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63317#p63317</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63317#p63317"/>
		<title type="html"><![CDATA[duraiton help [SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63317#p63317"><![CDATA[
Hello, yes i know this has been asked and i searched for "duration" but can't fiure out im a newbie to TCL and is a hard language i did not code tthsi script is just part of it but what im tryign to do is instead of showing <br><div class="codebox"><p>Code: </p><pre><code>05/23/2006 7:45:PM</code></pre></div>i wan't somethign like this<br><div class="codebox"><p>Code: </p><pre><code>2 weeks 1 day 3 hours 4 mins 30 secs 05/23</code></pre></div>something liek this i been looking at this pice of the code but cant get it <br><div class="codebox"><p>Code: </p><pre><code>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 &gt; "2000000000"} { error "unx2nps: parameter is too large" } return [clock format $timestamp -format "%m/%d/%Y %l:%M:%p"]}</code></pre></div>i was tryign to set something like<br><br>set blah [duration $unx2nps]<br><br>but then the script does nto output the info <br><br>any help would be thanksfull <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <br><br>Thank You<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7761">Slightz</a> — Tue May 23, 2006 8:32 pm</p><hr />
]]></content>
	</entry>
	</feed>
