Thread: certain time

  1. #1
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    231

    certain time

    Hey all. I was making a program for my dad and I am painstakingly close to finishing. The only thing I have left to figure out is how do you make a program that will open another program or execute another part of the code at a certain time, I was thinking something along the lines of a while loop that has a variable that changes with the time and a variable that says lets say 12 (for noon and midnight) then it just keeps going on with this loop, that would look like this I believe:

    Code:
    while(timevariable != staticvariable){
    \\changes timevariable with the time (if it does change)
    
    }
    \\ gets out of the loop when the time is equal
    system("file being opened");
    the thing I need to know is, how do you change timevariable so it equals the time
    thanks, xniinja

  2. #2
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Create a struct tm object; populate it with the current time; compare its member tm_hour to 0 (midnight) or 12 (noon) and take action accordingly.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get current time
    By tsubasa in forum C Programming
    Replies: 3
    Last Post: 05-01-2009, 02:03 AM
  2. Replies: 11
    Last Post: 03-29-2009, 12:27 PM
  3. Help with assignment!
    By RVDFan85 in forum C++ Programming
    Replies: 12
    Last Post: 12-03-2006, 12:46 AM
  4. calculating user time and time elapsed
    By Neildadon in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2003, 06:00 PM
  5. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM