Thread: time calculations

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    time calculations

    I am attempting to write a program that take the system clock and store the individual components of the time (hour, minutes, seconds, etc.) in separate variables or an array. Does anyone know how to do this? I am newbie, so bear with me. Thanks.

  2. #2
    pwning noobs Zlatko's Avatar
    Join Date
    Jun 2009
    Location
    The Great White North
    Posts
    132
    I think you need the localtime function. See localtime(3) - Linux man page .
    To get the time_t parameter to pass into localtime, use time_t myTime = time(NULL);
    Available on linux or Windows.

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    2
    Thanks a bunch. I'm new to C programming.

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. calculating user time and time elapsed
    By Neildadon in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2003, 06:00 PM
  4. Is this really true or it's just science fiction?
    By Nutshell in forum A Brief History of Cprogramming.com
    Replies: 145
    Last Post: 04-09-2002, 06:17 PM
  5. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM