Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 392531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:10:05+00:00 2026-05-12T16:10:05+00:00

I’ve been scratching my head over this one for a couple hours now, I’ve

  • 0

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…)!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:10:06+00:00Added an answer on May 12, 2026 at 4:10 pm

    Creating a small test program based on your code:

      public class Program
      {
        public static void Main(string[] args)
        {
          List<TestJob> jobList = new List<TestJob>();
    
          jobList.Add(new TestJob() { ID = 1 });
          jobList.Add(new TestJob() { ID = 2 });
          jobList.Add(new TestJob() { ID = 3 });
          jobList.Add(new TestJob() { ID = 4 });
    
          CalcuateEstimatedExecutionTimesForDueJobs(jobList);
    
          foreach (TestJob job in jobList)
          {
            Console.WriteLine("{0} {1} {2}", job.ID, job.StartDate, job.FinishedDate);
          }
          Console.ReadLine();
        }
    
        private static void CalcuateEstimatedExecutionTimesForDueJobs(List<TestJob> dueJobs)
        {
          DateTime rollingTime = DateTime.Now;
    
          foreach (TestJob job in dueJobs)
          {
            job.SetEstimatedStart(rollingTime);
    
            double estimatedRuntime = job.GetEstimatedRuntime();
            rollingTime = rollingTime.AddSeconds(estimatedRuntime);
    
            job.SetEstimatedFinish(rollingTime);
          }
        }
      }
    
      public class TestJob
      {
        public int ID { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime FinishedDate { get; set; }
        public void SetEstimatedStart(DateTime date)
        {
          this.StartDate = date;
        }
        public void SetEstimatedFinish(DateTime date)
        {
          this.FinishedDate = date;
        }
    
        public double GetEstimatedRuntime()
        {
          return 42; //Answer to Life, the Universe, and Everything
        }
    
      }
    

    Reveals that everything works as expected. The console output is:

    1 02.10.2009 17:08:43 02.10.2009 17:09:25
    2 02.10.2009 17:09:25 02.10.2009 17:10:07
    3 02.10.2009 17:10:07 02.10.2009 17:10:49
    4 02.10.2009 17:10:49 02.10.2009 17:11:31
    

    Which is, as far as I can tell correct.
    Please double check your dependent code in your TestJob class and debug / log everything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.