Thanks for the quick tutorial. I think the expiration time in seconds
would have been a much cleaner solution, but that would mean changing
all the downstream scripts.  I used the regsub command to clean up
the date and it works just fine now.

Thanks again,
 David
-------------
Original Text
From: "J.R.Suckling" <[EMAIL PROTECTED]>, on 01/18/00 12:33 PM:
David Mannan wrote:
> 
> Greetings TCL World;
> 
> I've been having a problem with variables set by the system "date" 
command
> whenever the day of the month/year is "008" or "009".  This has popped 
up
> several times before, and is easy enough to patch around - but now it 
has
> moved to "018".

Heres something to think about

$ tcl

tcl>expr 08
Error: syntax error in expression "08"

tcl>expr 07
7

tcl>expr 010
8

Get the picture? 
You are feeding expr what it thinks are octal numbers.
Since '8' is not a valid octal digit you get a syntax error.

The answer seems to be  the question of 
how are you going to strip off the leading zeros given by the 
system date command.
My answer would be regexp, but, I leave that to you.

BTW, 

try this:

tcl> clock seconds
948218715

tcl>clock format [ clock seconds ]
Tue Jan 18 13:02:30 EST 2000

tcl>clock format [ clock seconds ] -format %j
018

Another thing to think about is using clock seconds rather
then days to expire stuff.
That way you do not have things like years to wrap.

Of course should remind us of the year 2038 bug.
how is tcl going to deal with this one?
I would not want to come out of retirement 
at 80 years old to fix this one.  :)

---------------------------------------------------------------------------
To unsubscribe from the Visual Tcl mailing list, please send a message
to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in the
message body (where [EMAIL PROTECTED] is your e-mail address).

Reply via email to