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.

calculating days

Help for those learning Tcl or writing their own scripts.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

iamdeath wrote:Time registered: Mar 07 21:22:37 2006 EST

If the format is like that, should'nt it work?
Yes ( http://tcl.tk/man/tcl8.4/TclCmd/clock.htm#M45 )
Have you ever read "The Manual"?
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

user wrote:
iamdeath wrote:Time registered: Mar 07 21:22:37 2006 EST

If the format is like that, should'nt it work?
Yes ( http://tcl.tk/man/tcl8.4/TclCmd/clock.htm#M45 )
Thanks alot but I did'nt get that.. Can you please be more specific

Thanks
|AmDeAtH @ Undernet
Death is only the *Beginning*...
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Keep in mind that lrange returns a list, not a string..
Might want to join it into a string before trying to scan it.

Code: Select all

set then [clock scan [join [lrange [split $text] 3 end]]]
The timestamp you mentioned should work just fine with "clock scan":

Code: Select all

[11:31] > .tcl clock scan "Mar 07 21:22:37 2006 EST"
[11:31] < Tcl: 1141784557
NML_375
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Thanks alot nml :-)

The problem was coming because I was using lrange 3 end when 2 end was needed :D

Thanks alot soo much, you guys rock.
iamdeath
|AmDeAtH @ Undernet
Death is only the *Beginning*...
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Clock scan is picky about the format you give it, the manpage doesn't say it but the commas shown in the example formats are necessary. EG: day, dd monthname yy or monthname dd ?, yy?

There's a little more detail here:
http://forum.egghelp.org/viewtopic.php?p=67017#67017
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Thanks alot rosc, that helps much.
Thanks once again
iamdeath
|AmDeAtH @ Undernet
Death is only the *Beginning*...
Post Reply