This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

timestamp generation

Help for those learning Tcl or writing their own scripts.
Post Reply
k
kennycheung21
Voice
Posts: 10
Joined: Wed Mar 02, 2011 7:22 pm

timestamp generation

Post by kennycheung21 »

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!
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

Code: Select all

set random [expr { int(100 * rand()) }]
for the random number between 0-100

Code: Select all

set timestamp [clock seconds]
for the time-stamp..

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


hope this helps..
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Re: timestamp generation

Post by willyw »

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 ... mands.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.

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
Post Reply