Re: Automatic format of "time remaining" messages
Re: Automatic format of "time remaining" messages
- Subject: Re: Automatic format of "time remaining" messages
- From: Scott Anguish <email@hidden>
- Date: Fri, 5 Dec 2003 00:45:26 -0500
On Dec 4, 2003, at 8:17 PM, Daniel Aarno wrote:
For example when the finder performs a lengthy copy task it displays
the estimated time remaining. This is displayed in an "inexact"
manner, e.g. About 5 minutes remaining. This is good because it avoids
the "flickering" that occurs when the estimate is not exact (as it
seldom is because it's an estimate) and the ETA may change from 02:34
to 02:45 between updates. Now to the question:
Is there a way to automatically get these type of "inexact" time
remaining messages from say an NSTimeInterval or an NSDate? If there
is I assume it is in the correct localized version.
I don't think there is.. but it's really just figuring out the time
between the two and rounding to minutes..
estimatedTimeInSeconds=500;
startTime=[NSDate date];
then periodically check the time
timeInterval=estimatedTimeInSeconds-[[NSDate date]
timeIntervalSinceDate:startTime];
the time interval is in seconds remaining, so either round that, or
div it.. compare it to the current time if the time hasn't changed
enough, update the display..
be sure to allow for it taking longer than you expected.. :-)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.