Thread: getting time of day

  1. #1
    UNIX chick
    Join Date
    Mar 2003
    Posts
    92

    getting time of day

    I want the time of day to be displayed in a program, but I don't want the day, year or the date. I checked out the functions ctime(), asctime() and tried to have a look at strftime() (but it didn't make much sense). The best sollution I could come up with was copying the output of ctime() to a string and then extract the time of day. But this is a whole operation, which I'm guessting is both time and memory consuming - at least if it's to be done every second.

    Is there a simpler way to display just the time of day? Or is my sollution ok? If needed, I'll include some code here.

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    UNIX chick
    Join Date
    Mar 2003
    Posts
    92
    Awesome, thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. time synchronization problem
    By freeindy in forum C Programming
    Replies: 1
    Last Post: 04-19-2007, 06:25 AM
  2. Need help with time
    By Gong in forum C++ Programming
    Replies: 7
    Last Post: 01-11-2007, 02:43 PM
  3. Should I learn a FULL language first?
    By Raeliean in forum Game Programming
    Replies: 8
    Last Post: 07-16-2005, 06:59 PM
  4. Killing someones grandparents
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 37
    Last Post: 09-07-2003, 07:56 AM
  5. Windows XP regression over time
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 12-17-2002, 10:49 AM