egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

timestamp generation

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
kennycheung21
Voice


Joined: 02 Mar 2011
Posts: 10

PostPosted: Fri Mar 25, 2011 12:46 pm    Post subject: timestamp generation Reply with quote

Hello everyone,

I'm wondering if there is any function i can use to generate a timestamp in tcl script?
And if there is any other function to generate a random number in a given range?

Please help and thank you!
Back to top
View user's profile Send private message
doggo
Halfop


Joined: 05 Jan 2010
Posts: 97

PostPosted: Fri Mar 25, 2011 4:47 pm    Post subject: Reply with quote

Code:
set random [expr { int(100 * rand()) }]


for the random number between 0-100

Code:
set timestamp [clock seconds]


for the time-stamp..

you can then use the VARS $random $timestamp in yr script Smile


hope this helps..
_________________
NON geeky!! http://gotcode4u.com/
Back to top
View user's profile Send private message Visit poster's website
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Fri Mar 25, 2011 7:32 pm    Post subject: Re: timestamp generation Reply with quote

kennycheung21 wrote:
Hello everyone,

I'm wondering if there is any function i can use to generate a timestamp in tcl script?


http://www.eggheads.org/support/egghtml/1.6.20/tcl-commands.html
and check out:
strftime

This will be handy for reference too:
http://linux.about.com/library/cmd/blcmdl3_strftime.htm

You can get the date and/or time in just about any format you want, with strftime.

Quote:


And if there is any other function to generate a random number in a given range?



Same place - tcl-commands.doc - and check out:
rand
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber