The current date is: 02/10/03 and the *old* one is: 01/27/03.
I use the date like this: [clock format [clock seconds] -format %D] and the old time *results* exactly like date (eg. 01/27/03).
Is there a easier way I can to a *time difference* betwen this two? Tryed to 'split' them and then do some 'expr' on each item (month, day and year).. but is hard and verry confusing this way.
Once the game is over, the king and the pawn go back in the same box.
I've found something: set result [clock format [expr [clock scan $date] - [clock scan $expire]] -format {%m %d}]
but I'm getting the result like this: 01 15 (months, days) so, in fact the difference betwen them is 15 days.. not 1 month and 15 days. Any sugestions?
Once the game is over, the king and the pawn go back in the same box.
caesar wrote:I've found something: set result [clock format [expr [clock scan $date] - [clock scan $expire]] -format {%m %d}]
but I'm getting the result like this: 01 15 (months, days) so, in fact the difference betwen them is 15 days.. not 1 month and 15 days. Any sugestions?
The clock format does not tell it is 1 month *and* 15 days. It tells you that the number you asked to be formatted is January 15.
By subtracting the two numbers you get the number of seconds since the unix clock started: 1209600 seconds in your case.
The number you feed into [clock format] is the number of seconds since 01/01/1970 00:00 GMT.
Which in your case is 15 days into the first month since "01/01/1970 00:00 GMT". So, what you are seeing is 15/01/1970 00:00 GMT.
What you can use is [duration] which takes a relative number.
Actualy I've tryed 'duration' also, but stucked in something and didn't continued. Was tyred last night and didn't consulted the manual. I'll read about it now. Thanks for the tip.
Once the game is over, the king and the pawn go back in the same box.