Time functions problems

This is a discussion on Time functions problems within the C Programming forums, part of the General Programming Boards category; Hello, I'm trying to convert a date like this : "20-12-01" to seconds or millisenconds. I don't find the tight ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    2

    Time functions problems

    Hello,

    I'm trying to convert a date like this : "20-12-01" to seconds or millisenconds.

    I don't find the tight function to do that.

    Many thanks for helping me,
    Christophe

  2. #2
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    The function should be time(). Look up the syntax of it.
    1978 Silver Anniversary Corvette

  3. #3
    Unregistered
    Guest
    time_t time(time_t *t);

    takes a pointer to type time_t and stores in the value pointed to the current time(on most systems this is the amount of seconds from January 1, 1970, but this is not guaranteed) and also returns that value. This function will not convert a date to milliseconds. You have to do some string parsing. How are you deciding what millisecond value represents what date? Is it milliseconds since a certain date?

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    2

    Thumbs up

    This function seems to be the good one to use.
    In fact, I need to use a function (developped by somebody else) that takes in the date in milliseconds format.

    I just need to find out what is the time_t type.
    Maybe if I don't find, I'll ask you again.

    Thanks,
    Chris

  5. #5
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    time_t??? In my whole career of programming C, I've never encountered that data type. Explain, please.
    1978 Silver Anniversary Corvette

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    time.h has this information. Here is another reference.

    Quzah.
    Hope is the first step on the road to disappointment.

  7. #7
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Thanks, quzah.
    1978 Silver Anniversary Corvette

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using pointers
    By Big_0_72 in forum C Programming
    Replies: 3
    Last Post: 10-28-2008, 07:51 PM
  2. gluTess functions and callback problems
    By uldaman in forum Game Programming
    Replies: 5
    Last Post: 02-28-2008, 08:24 AM
  3. having a real tough time with functions..
    By simstim99 in forum C++ Programming
    Replies: 6
    Last Post: 04-30-2007, 12:48 AM
  4. need help in time zone
    By Gong in forum C++ Programming
    Replies: 2
    Last Post: 01-03-2007, 03:44 AM
  5. Functions problems!
    By Paninaro in forum C Programming
    Replies: 2
    Last Post: 06-18-2002, 06:03 AM

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