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

	<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>2007-06-12T18:12:57-04:00</updated>

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

		<entry>
		<author><name><![CDATA[AskMe]]></name></author>
		<updated>2007-06-12T18:12:57-04:00</updated>

		<published>2007-06-12T18:12:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73505#p73505</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73505#p73505"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73505#p73505"><![CDATA[
<blockquote class="uncited"><div>I don't suppose you've considdered using mysql's locale-support along with proper date/Time-fieldtypes?</div></blockquote> your right<br><br><br>im new with tcl and mysql so you see what it does <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>ill make some research on mapping and date/Time-fieldtypes.<br><br>thanks for your time <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=8905">AskMe</a> — Tue Jun 12, 2007 6:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-06-12T18:04:53-04:00</updated>

		<published>2007-06-12T18:04:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73504#p73504</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73504#p73504"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73504#p73504"><![CDATA[
Locale support is somewhat limited in tcl, so you'd probably be best off using some string mapping if you'd like the date in a different language.<br><br>I don't suppose you've considdered using mysql's locale-support along with proper date/Time-fieldtypes?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Jun 12, 2007 6:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[AskMe]]></name></author>
		<updated>2007-06-12T17:53:14-04:00</updated>

		<published>2007-06-12T17:53:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73503#p73503</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73503#p73503"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73503#p73503"><![CDATA[
<blockquote class="uncited"><div>Also, executing that code you posted once in globalspace will only result in $date holding the time for that particular moment, and not current date. </div></blockquote>thanks i didnt know that info<br><br>and the link have almost all info i need<div class="codebox"><p>Code: </p><pre><code>proc addvoicedb {nick host hand chan args} {  global mysqlink UCSRegistered  set username [UCS:Registered:IsRegistered $nick]  set hostmask "*!*@[lindex [split $host @] 1]"  mysqlexec $mysqlink "INSERT INTO voice (nick,username,chan,host,ajouté_le) VALUES ('$nick','$username','$chan','$hostmask','[clock [clock seconds] -format "%Y.%m.%d"]')" }</code></pre></div>if i want the monthname i have to replace the %m by %b or %B right?<br><br>if i want to replace the monthname by the monthname but in french is it possible?<br><br>sorry if im not clear but my english is limited..  <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=8905">AskMe</a> — Tue Jun 12, 2007 5:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-06-12T17:36:54-04:00</updated>

		<published>2007-06-12T17:36:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73502#p73502</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73502#p73502"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73502#p73502"><![CDATA[
Reading the manual page I linked on clock format, it should make it obvious you have no use for that string mapping, as the format used would already print the month in numbers.<br><br>Also, executing that code you posted once in globalspace will only result in $date holding the time for that particular moment, and not current date.<br><br>A proper example, you'll probably need to modify it to suite your needs:<br><div class="codebox"><p>Code: </p><pre><code>proc addvoicedb {nick host hand chan args} { global mysqlink UCSRegistered set username [UCS:Registered:IsRegistered $nick] set hostmask "*!*@[lindex [split $host @] 1]" mysqlexec $mysqlink "INSERT INTO voice (nick,username,chan,host,ajouté_le) VALUES ('$nick','$username','$chan','$hostmask',NOW())"}</code></pre></div>Or<div class="codebox"><p>Code: </p><pre><code>proc addvoicedb {nick host hand chan args} { global mysqlink UCSRegistered set username [UCS:Registered:IsRegistered $nick] set hostmask "*!*@[lindex [split $host @] 1]" mysqlexec $mysqlink "INSERT INTO voice (nick,username,chan,host,ajouté_le) VALUES ('$nick','$username','$chan','$hostmask','[clock [clock seconds] -format "%Y.%m.%d"]')"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Jun 12, 2007 5:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[AskMe]]></name></author>
		<updated>2007-06-12T17:26:14-04:00</updated>

		<published>2007-06-12T17:26:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73500#p73500</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73500#p73500"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73500#p73500"><![CDATA[
<blockquote class="uncited"><div>It would seem to me that you're trying to insert current date/time into a mysql-database</div></blockquote>your right<br><br><br><br>in fact i use<div class="codebox"><p>Code: </p><pre><code>set date [clock format [clock scan "now"] -format %Y.%m.%d]</code></pre></div>but i try to replace it by the maping of Sir_Fz to have the month listed with a name and not with a number<br>...<br><br>as you can see im a not a pro un tcl <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=8905">AskMe</a> — Tue Jun 12, 2007 5:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-06-12T17:10:46-04:00</updated>

		<published>2007-06-12T17:10:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73499#p73499</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73499#p73499"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73499#p73499"><![CDATA[
$date is not a predefined variable in globalspace, so you'll have to set it to some value before you attempt to read it.<br>It would seem to me that you're trying to insert current date/time into a mysql-database; in this case, I'd suggest you use the mysql-macro NOW(). Another option would be to use the <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/clock.htm" class="postlink">"clock format"</a> command.<br><br>Be adviced that $date will not automatically be updated to hold current time...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Jun 12, 2007 5:10 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[AskMe]]></name></author>
		<updated>2007-06-12T17:05:58-04:00</updated>

		<published>2007-06-12T17:05:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73498#p73498</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73498#p73498"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73498#p73498"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set date [string map {Jan 01 Fév 02 Mars 03 Avr 04 Mai 05 Juin 06 Juil 07 Aout 08 Sept 09 Oct 10 Nov 11 Déc 12} $date] ################### Voice database ###################proc addvoicedb {nick host hand chan args} {global sql botnick mysqlink date UCSRegistered  set username [UCS:Registered:IsRegistered $nick]  set hostmask "*!*@[lindex [split $host @] 1]"mysqlexec $mysqlink "INSERT INTO voice(nick,username,chan,host,ajouté_le) VALUES ('$nick','$username','$chan','$hostmask','$date')"putlog "$nick a été ajouté a la liste autovoice avec le username $username"  putserv "NOTICE $nick :Vous etes maintenant ajouté à la liste auto voice sur $chan sous le username $username"}</code></pre></div>the whole script i a bit messy but this is the only procedure i use <strong class="text-strong">date</strong><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8905">AskMe</a> — Tue Jun 12, 2007 5:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-06-12T16:45:38-04:00</updated>

		<published>2007-06-12T16:45:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73497#p73497</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73497#p73497"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73497#p73497"><![CDATA[
Post the whole script, as it would seem you've placed that line of code incorrectly...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Jun 12, 2007 4:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[AskMe]]></name></author>
		<updated>2007-06-12T16:43:36-04:00</updated>

		<published>2007-06-12T16:43:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73496#p73496</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73496#p73496"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73496#p73496"><![CDATA[
<blockquote class="uncited"><div>The mapping is supposed to be a list, so it's better to use:<div class="codebox"><p>Code: </p><pre><code>set date [string map {Jan 01 Feb 02 Mar 03 Apr 04 May 05 Jun 06 Jul 07 Aug 08 Sep 09 Oct 10 Nov 11 Dec 12} $date]</code></pre></div>instead.</div></blockquote>i try this one (in french)<div class="codebox"><p>Code: </p><pre><code>set date [string map {Jan 01 Fév 02 Mars 03 Avr 04 Mai 05 Juin 06 Juil 07 Aout 08 Sept 09 Oct 10 Nov 11 Déc 12} $date] </code></pre></div>and i got this error when rehash<div class="codebox"><p>Code: </p><pre><code>can't read "date": no such variablewhile executing"string map {Jan 01 Fév 02 Mars 03 Avr 04 Mai 05 Juin 06 Juil 07 Aout 08 Sept 09 Oct 10 Nov 11 Déc 12} $date"invoked from within"set date [string map {Jan 01 Fév 02 Mars 03 Avr 04 Mai 05 Juin 06 Juil 07 Aout 08 Sept 09 Oct 10 Nov 11 Déc 12} $date] "</code></pre></div>what i do wrong?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8905">AskMe</a> — Tue Jun 12, 2007 4:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[w00f]]></name></author>
		<updated>2007-06-03T08:51:32-04:00</updated>

		<published>2007-06-03T08:51:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73236#p73236</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73236#p73236"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73236#p73236"><![CDATA[
thanks guys , ill try string map <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=8264">w00f</a> — Sun Jun 03, 2007 8:51 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2007-06-02T20:59:00-04:00</updated>

		<published>2007-06-02T20:59:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73234#p73234</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73234#p73234"/>
		<title type="html"><![CDATA[Re: Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73234#p73234"><![CDATA[
<blockquote class="uncited"><div>hey, i have a little prob. I'm trying to calc the "wait time" between "now" and some "date".<br>The date format is monthname/day/year (%b/%d/%Y). <br>i.e. date = "Jul/04/2007".<br>im using clock scan , but since its free-form scan i cant use -format in way to set the expected input. only -gmt and -base options are available.<br><br>atm i have this<div class="codebox"><p>Code: </p><pre><code>set waitime [duration [expr [clock scan $date -format {%b/%d/%Y}] - [clock seconds]]]</code></pre></div>i get this , Tcl error: bad switch "-format": must be -base or -gmt :/<br>any way to fix this ?<br><br><br>ty in advance.</div></blockquote>The [clock scan] command does not have a -format switch.<br><br>Edit: Suggested [clock format] but the [string map] seems to be the only (best) solution.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sat Jun 02, 2007 8:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2007-06-02T20:53:44-04:00</updated>

		<published>2007-06-02T20:53:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73233#p73233</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73233#p73233"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73233#p73233"><![CDATA[
The mapping is supposed to be a list, so it's better to use:<div class="codebox"><p>Code: </p><pre><code>set date [string map {Jan 01 Feb 02 Mar 03 Apr 04 May 05 Jun 06 Jul 07 Aug 08 Sep 09 Oct 10 Nov 11 Dec 12} $date]</code></pre></div>instead.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sat Jun 02, 2007 8:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2007-06-02T19:46:06-04:00</updated>

		<published>2007-06-02T19:46:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73232#p73232</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73232#p73232"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73232#p73232"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set date [string map "{Jan} {01} {Feb} {02} {Mar} {03} {Apr} {04} {May} {05} {Jun} {06} {Jul} {07} {Aug} {08} {Sep} {09} {Oct} {10} {Nov} {11} {Dec} {12}" $date]</code></pre></div>Like he said, not the prettiest.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Sat Jun 02, 2007 7:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-06-02T17:55:57-04:00</updated>

		<published>2007-06-02T17:55:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73230#p73230</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73230#p73230"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73230#p73230"><![CDATA[
One approach might be "string map". Perhaps not the prettiest solution, but should do the trick.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Jun 02, 2007 5:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[w00f]]></name></author>
		<updated>2007-06-02T17:46:57-04:00</updated>

		<published>2007-06-02T17:46:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=73229#p73229</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=73229#p73229"/>
		<title type="html"><![CDATA[Calculate time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=73229#p73229"><![CDATA[
the problem is the month , if the month was in number format instead of name the code certainly works.<br><div class="codebox"><p>Code: </p><pre><code>.tcl [duration [expr {[clock scan 07/06/2007] - [clock seconds]}]]ew : Tcl: 4 weeks 5 days 1 hour 13 minutes 44 seconds.tcl [duration [expr {[clock scan Jul/06/2007] - [clock seconds]}]]ew : Tcl: unable to convert date-time string "Jul/06/2007"</code></pre></div>if i convert the Jul/06/2007 to 07/06/2007 should work. but how i do that ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8264">w00f</a> — Sat Jun 02, 2007 5:46 pm</p><hr />
]]></content>
	</entry>
	</feed>
