Some questions on caledar algebra. (or I've got a shareware engineeeeeeee)

Andre Garzia soapdog at mac.com
Wed Sep 24 11:09:01 EDT 2003


On Wednesday, September 24, 2003, at 12:43  PM, Klaus Major wrote:

> You can convert a date to dateitems, add the number of days to item 3 
> of it and convert back to date :-)
>
> dateitems: Very cool feature :-)
>
> on mouseup
>   convert the date to dateitems ### today = 9/24/03
>   add 8 to item 3 of it ## just add 8 days
>   convert it to date
>   put it
> end mouseup
>
> ---> 10/2/03
>
> Maravilhoso!!! :-D


HaHaHaHa Oh Boy!!!!!!! Never dreamed of this! Thank you Klaus.

I solved it using the hard way, I first read the instalation date in 
seconds from the prefs file. Then I get custom property cDaysToRun from 
the desired stack and convert it to seconds (the hard way!), sum the 
instalation data and my DaysToRun in Seconds and compare it to the 
current date in seconds. If Current date is bigger (or equal) software 
has expired, send message with error to desired stack. If the 
ExpireDate is bigger than we got some time left, send message back to 
desired stack with the ammount of days left in Second format! You can 
do little tricks like showing users exactly when it will expire in 
dd/mm/yy hh:mm:ss format.... it's a dumb geek solution, but it's 
working! This stack will be released tomorrow.

Thank you again!!!! (if only I waited another 10 minutes and checked 
mail, it would be all so much clearer)

Andre

-- Get Shareware info
   get the cDaysToRun of stack pid
   if it is empty then
     get field "daysfield"
   end if
   put it into tDaysToRun

   if checkFile(pFile) then
     get ReadRegisterInfo(pFile)
     convert it to seconds
     put it into tInitialRun
     put tDaysToRun * 24 *60 * 60 into tDayInc
     put tDayInc + tInitialRun into tExpireDate


     if (tExpireDate <= tDateInSec) then
       put "err: software expired." into it
     else
       get  tExpireDate - tDateInSec
       end if

     send "echoRegister it" to pid
   else
     get saveRegisterInfo(pFile)
     send "echoRegister it" to pid
   end if


Andre Garzia  2003
imac2 ibook p100 e uma torradeira....




More information about the use-livecode mailing list