Thread: CTS.ReLoADeD
View Single Post
Old 03-07-2005, 12:21 PM  
kiezz
Junior Member
 
Join Date: Feb 2004
Posts: 27
Default

Hi jeza , i'm glad you are looking on my project .
Tcl 8.5+ bring new improuvment on clock command , very very usefull:
(http://www.tcl.tk/man/tcl8.5/TclCmd/clock.htm)

clock add timeVal ?count unit...? ?-option value?

I've tested this under Linux , whit this is very simple, also for trial time across month end.
My code whit this is :

set u_trial [lindex $text 0]
putlog "user in trial: $u_trial"
set trial_list [open $cts(progdir)/cts/logs/cts.trials.users a]
set now [clock format [clock seconds] -format {%m/%d/%Y@%H:%M:%S}]
set c_now [clock seconds]
---> set a [clock add $c_now $cts(tday) days] <-----
set end [clock format $a -format {%m/%d/%Y@%H:%M:%S}]
puts $trial_list "$u_trial|$now|$end"
close $trial_list


However on Windrop is unrecognised (do to tcl 8.4), whitout that the code is:

set u_trial [lindex $text 0]
putlog "user in trial: $u_trial"
set trial_list [open $cts(progdir)/cts/logs/cts.trials.users a]
set now [clock format [clock seconds] -format {%m/%d/%Y@%H:%M:%S}]
set day [clock format [clock seconds] -format {%d}]
set nday [expr $day + 7]
set month [clock format [clock seconds] -format {%m}]
set year [clock format [clock seconds] -format {%Y}]
set time [clock format [clock seconds] -format {%H:%M:%S}]
set c_now [clock seconds]
set end "$month/$nday/$year@$time"
puts $trial_list "$u_trial|$now|$end"
close $trial_list

But the problem is if you want start a trial of 7 days starting the 28 you get the end trial day on 35 ....

Thanks for help , ByE
kiezz is offline   Reply With Quote