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

  • Home
  • SEARCH
  • 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 4115954
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:38:53+00:00 2026-05-20T22:38:53+00:00

This should be trivial, but my brain is running into a brick wall tonight.

  • 0

This should be trivial, but my brain is running into a brick wall tonight.

I have a process that will run once, then every n minutes of an hourly offset.

EG, 15 minutes means run on the hour (say, 1), then 1:15, 1:30, 1:45, etc.

If the execution interval is 15, the initial execution is at 1:07 and runs until 1:11, the wait for the next execution will be in 4 minutes.

If the execution interval is 15, the initial execution is at 1:07 and runs until 1:16, the wait for the next execution will be 14 minutes (execution times do not overlap).

So, after every run (of an varying length), how do we calculate the number of minutes to wait until the next execution?


I’m not putting any sample code in here, because I don’t have anything that will pass my unit tests (I’m not so brain-dead that I can’t write those !).

I’ve tagged this as C# since that’s what I’m coding in, but I would expect the solution to be language-agnostic.

  • 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-20T22:38:54+00:00Added an answer on May 20, 2026 at 10:38 pm

    Okay, just as I hit submit on the question, I had an epiphany.

    Given currentMinute >= 0 and executionInterval >= 1

    absolute-value((currentMinute modulo executionInterval) - executionInterval)

    or, in C#

    return Math.Abs((currentMinute % executionInterval) - executionInterval);

    so far, my unit-tests are passing on this one. So, either it is correct, or I don’t have enough tests….

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

Sidebar

Related Questions

This should be incredibly trivial, but it's not. I have a predefined height for
I know this might sound that it should be trivial but I am finding
This should be a trivial question. But I am confused. I want to print
This should be a no brainer but I have a small mystery with the
This should be simple, but I'm getting confused. I have a parent/child tables -
This should be quite simple, but I can't work out the syntax. I have
This should be a simple issue but I can't figure this out. I have
This should be pretty trivial but for whatever reason, I'm having a little trouble
This should be a pretty trivial one. Can C# return a type that is
OK, this should be brainlessly trivial, yet I can't manage to run. MS Access.

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.