I’ve been scratching my head over this one for a couple hours now, I’ve drafted in co-workers and we are all lost. This could be a case of too much coffee from the new espresso machine, or the fact it’s Friday… We’re not sure!
I have the following method:
private void calcuateEstimatedExecutionTimesForDueJobs(List<TestJob> dueJobs)
{
DateTime rollingTime = DatabaseConnection.getNow();
foreach (TestJob job in dueJobs)
{
job.setEstimatedStart(rollingTime);
double estimatedRuntime = job.getEstimatedRuntime();
rollingTime = rollingTime.AddSeconds(estimatedRuntime);
job.setEstimatedFinish(rollingTime);
}
}
The intention is to process a list of “TestJobs” which our app is queued to deliver. Our TestJob kindly knows how long it will “probably” take to run so I hope to use this information here to predict the “Start” & “Finish” times of each TestJob.
Unfortunately, rollingTime is never altered. Although job.getEstimatedRuntime() always returns a positive double, calling AddSeconds() on the current TestJob and passing this value has no effect.
Is there a bug in my code, or something more sinister?
Update: I noticed that this question is still getting a few views. For those of you suffering an odd issue like mine, I remember resolving this one by simply restarting Visual Studio / Rebooting. I guess this issue still crops up from time to time… (Ahem…)!
Creating a small test program based on your code:
Reveals that everything works as expected. The console output is:
Which is, as far as I can tell correct.
Please double check your dependent code in your TestJob class and debug / log everything.