Display a future time

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
MikeC
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9
Joined: Tue Sep 18, 2012 2:12 pm

Display a future time

Post by MikeC » Tue Jan 08, 2013 10:32 am

I have a repeat loop processing a large data file.
I can get "the seconds" when it starts, and when it finishes the first pass.
Knowing how many repeats are involved, I can estimate how long the process will take.

But how can I add this value to the start time in order to display "Estimated finish time xxxx o'clock"

Thanks.

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Display a future time

Post by bangkok » Tue Jan 08, 2013 11:42 am

Convert will do the trick.

One example :

on mouseUp
put the time into abc
answer abc
convert abc to seconds
answer abc
add 120 to abc
convert abc from seconds to time
answer abc
end mouseUp

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Display a future time

Post by jmburnod » Tue Jan 08, 2013 11:50 am

Hi MikeC,

I put a little stack with an example that work on a loop with progressbar
It is not perfect but I think it is a good beginning

Best regards
Jean-Marc
Attachments
ProgressbarWithEstimatedTime.livecode.zip
(1.25 KiB) Downloaded 198 times
https://alternatic.ch

MikeC
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9
Joined: Tue Sep 18, 2012 2:12 pm

Re: Display a future time

Post by MikeC » Tue Jan 08, 2013 3:06 pm

Thanks folks for these two good examples that put me in the right direction.

I ended up making use of the "dateItems" format, adding the number of anticipated seconds for the repeat loop to item 6 of this container.
Then converted it back to time format to display the actual time the process would finish.

Thanks again.

Mike

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Display a future time

Post by Klaus » Tue Jan 08, 2013 5:18 pm

Yep, "dateitems" is a very cool tool to manipulate/compute date and time!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Display a future time

Post by dunbarx » Tue Jan 08, 2013 8:56 pm

I don't know how involved your repeat loop is, but you may want to use the "ticks" or the "milliseconds". Seconds seems like a lifetime, unless your execution time is of that order.

Craig Newman

Post Reply