Creating a Clock

This is a discussion on Creating a Clock within the Windows Programming forums, part of the Platform Specific Boards category; Im working on this program and its a client server program and so when the client connects, I want a ...

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    215

    Creating a Clock

    Im working on this program and its a client server program and so when the client connects, I want a clock at the bottom of the window basically like this: 0:00:00, and for it to count how long Ive been connected and to keep counting until i have disconnected or exited the program. Ive checked the msdn website but it only has things for timers. I was wondering if someone could help. thanks!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,540
    Use time() to record the time when the application starts (this is t1)
    Use time() whenever you are about to refresh the display (this is t2)
    Use difftime() to work out the elapsed seconds between t1 and t2
    Format to your personal taste
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    215
    Do you have an example on how to actually code that. I dont understand how Id code that.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical Error in Clock program
    By SVXX in forum C++ Programming
    Replies: 0
    Last Post: 05-10-2009, 12:12 AM
  2. Outside influences on clock cycles? (clock_t)
    By rsgysel in forum C Programming
    Replies: 4
    Last Post: 01-08-2009, 05:15 PM
  3. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  4. Clock Troubles
    By _Nate_ in forum C Programming
    Replies: 22
    Last Post: 06-19-2008, 05:15 AM
  5. clock program
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 10:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21