I have a class function. That function starts a thread, whose sole purpose is to call an SDK function. That SDK function reports progress back via a special CALLBACK function. I would like to be able to report to the user an estimate of how long the SDK function will take to complete.
All that I get back from the SDK is a double representing the progress so far; between 0 and 1.0. Not very useful. So I put some thought in, and came up with the idea of having an independent timer running alongside the SDK CALLBACK. Setting the timer up to send a message to me every one second, I could wait until, say, two seconds have passed, then look at how much progress has been made in the CALLBACK. I could then base calculations on the time remaining around the fact that on average, ( progress made in two seconds / 2 ) % progress is made every one second. And go from there...
This sounds a bit messy though. I would need some sort of member variable holding the number of seconds passed as reported by my timer, that the CALLBACK also has access to. Then I would need to protect access to that variable possibly...
Not a serious problem, but I am guessing that someone has come across this kind of issue before.
Any better ideas ?