Convert to seconds, why??

Ken Ray kray at sonsothunder.com
Tue May 27 14:10:01 EDT 2003


Francois,

One issue is that you can't use "convert <x> from <y> to <z>" but
instead use "convert <x> to <z>", that is, "convert tampon to seconds"
instead of "convert tampon from long time to seconds". 

Secondly, the "long time" is the number of seconds since Jan 1, 1970 (I
think it's Jan 1), so since you're not working with dates and actual
times you shouldn't use "time" values at all, IMHO. How about something
like this:

on mouseUp
  put fld "règletemps" into tTime  --BTW don't need "cd" in front of
"fld"
  set the itemDel to ":"
  put item 1 of tTime into tHours
  put item 2 of tTime into tMins
  put item 3 of tTime into tSecs
  set the numberFormat to "00"
  add 30 to tSecs
  add (tSecs div 60) to tMins
  put (tSecs mod 60) into tSecs
  add (tMins div 60) to tHours
  put (tMins mod 60) into tMins
  put (tHours mod 24) into tHours
  put tHours & ":" & tMins & ":" & tSecs into fld "règletemps"
end mouseUp

Let me know how it goes,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 

> -----Original Message-----
> From: use-revolution-admin at lists.runrev.com 
> [mailto:use-revolution-admin at lists.runrev.com] On Behalf Of 
> François Cuneo
> Sent: Tuesday, May 27, 2003 1:40 PM
> To: use-revolution at lists.runrev.com
> Subject: Convert to seconds, why??
> 
> 
> Hello,
> 
> 
> 
> I have a field that show a timer.
> Each clic on the little Arrow, the user obtains 30 seconds more.
> 
> So the field shows 
> 00:05:00
> I click and after I should obtain
> 00:05:30
> I click and after I should obtain
> 00:06:00
> 
> I have written this script in the littlearrow
> 
> 
> on scrollbarLineDec
> 
>   set the twelveHourTime to false
> 
>   put cd fld "règletemps" into tampon
>   convert tampon from long time to seconds
> 
> 
>   put tampon-1053993600 into tampon
>   put tampon +29 into tampon
>   convert tampon from seconds to long time
>   put tampon into cd fld "règletemps"
>     
>   wait 6 ticks
>   
> end scrollbarLineDec
> 
> If I don't put 
> "put tampon-1053993600 into tampon
>   put tampon +29 into tampon"
> 
> But only 
> "Put tampon +30 into tampon"
> 
> All is wrong.
> 
> Whhhhhyyyyyyy?
> 
> 
> Thank you!
> 
> Friendly
> 
> François
> 
> > 
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com 
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> > 
> > 
> 
> 
> -------------- 
> François Cuneo
> Site Web dédié au Macintosh http://www.cuk.ch
> E-mail: francois.cuneo at cuk.ch
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com 
> http://lists.runrev.com/mailman/listinfo/use-> revolution
> 





More information about the use-livecode mailing list