Thread: timer using time.h

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    5

    timer using time.h

    I really need some help with creating a timer using time.h
    I am fairly good at c programming but time.h has always escaped me.
    I have to create a program that outputs the time in day, hours, minutes and seconds. I can probably do that part myself its just the actual timer part that I'm having trouble with.

  2. #2
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Provide some details about the timer.

  3. #3
    Registered User
    Join Date
    Oct 2011
    Posts
    5
    Thats my problem I have no idea where to start. I dont know how to work with time.h if you can provide something like an example of how to simple start a timer I can probably figure out the rest. There are no restrictions, just want it to be simple so im not looking up a million wierd things.
    EDIT:
    I guess if you wanted what im trying to accomplish.
    I want to make a timer that will be stopped by the user.
    When its stopped it will output the duration that the timer when for
    Last edited by ADHDadditiv; 10-05-2011 at 12:08 PM.

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Post your code, lets see what we're dealing with...

  5. #5
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by ADHDadditiv View Post
    Thats my problem I have no idea where to start. I dont know how to work with time.h if you can provide something like an example of how to simple start a timer I can probably figure out the rest. There are no restrictions, just want it to be simple so im not looking up a million wierd things.
    EDIT:
    I guess if you wanted what im trying to accomplish.
    I want to make a timer that will be stopped by the user.
    When its stopped it will output the duration that the timer when for
    1.Get the current time value in a time_t with time .
    2.Use difftime to generate the difference of the time when you want to stop, with the stored time. (Result in seconds,..)
    3. Convert the no of seconds to anything else you'd like.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Time/Timer program
    By black187 in forum Linux Programming
    Replies: 1
    Last Post: 05-09-2006, 05:53 AM
  2. Timer In C
    By unmeshghosh in forum C Programming
    Replies: 10
    Last Post: 04-21-2006, 01:00 PM
  3. Display timer same time as input
    By Yasir_Malik in forum Linux Programming
    Replies: 17
    Last Post: 12-31-2005, 03:42 PM
  4. Timer in 2D FPS
    By Jontay in forum Game Programming
    Replies: 4
    Last Post: 11-28-2003, 11:30 AM
  5. Putting Timer/Time Delays into your programs
    By newbie in forum C++ Programming
    Replies: 3
    Last Post: 09-07-2001, 08:19 PM