Created
May 28, 2014 10:31
-
-
Save burhan/e28043966217a454883b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > As part of my project, I need to trigger a functionality after 10 | |
| > years. | |
| Assuming 10 years is an arbitrary number and all you really want is to execute something after _X_ time has passed, do the following: | |
| 1. Create (and save) the time the program is created, since all calculations will be after this time. | |
| 2. In your program start-up/bootstrap logic, load/read the timestamp you saved in step #1, and grab the current time. | |
| 3. Compare the difference between the current time and the time that the program is created. If this difference isn't the interval you want, simply exit the program. | |
| 4. If this limit has passed, run the actual program itself. | |
| Once you have implemented that, you can have your operating system's normal scheduled task mechanism run your script every hour, every minute, etc. so it will do these steps. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment