Jump to content

Every 3rd day


TedEbear

Recommended Posts

Posted

I would use an integer variable. Set it to 0, and increment it by 1 every day at a given time (say 1 AM), and set the init value to the new value.

 

Then at whatever time you want something to happen, have another program that checks the current time AND if the variable is set to 3 or more. The if clause would take whatever action you want, and then set the variable (and init value) back to 0.

 

Then, given an example of something happening at 7 AM, the timeline would be:

 

Day1 - @1 AM - variable increments to 1

Day1 - @7 AM - variable is less then 3, program doesn't run

Day2 - @1 AM - variable increments to 2

Day2 - @7 AM - variable is less then 3, program doesn't run

Day3 - @1 AM - variable increments to 3

Day3 - @7 AM - variable is 3, program runs, resets to 0

Day4 - @1 AM - variable increments to 1

Day4 - @7 AM - variable is less then 3, program doesn't run

Day5 - @1 AM - variable increments to 2

Day5 - @7 AM - variable is less then 3, program doesn't run

Day6 - @1 AM - variable increments to 3

Day6 - @7 AM - variable is 3, program runs, resets to 0

Posted

Make sure that whenever you increment the variable (or set it to 0), you also increment or set the Init value - so the sequence survives reboots....

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.5k
×
×
  • Create New...