time.h

Discussion in 'C++' started by Szymon Bobek, Dec 11, 2004.

  1. Szymon Bobek

    Szymon Bobek Guest

    Hello,
    Is it possible to get time with precission to 1/100 of second using time.h?
    If yes - how? If not - where should I search for function which can do it?

    Thanx,
    Szymon
    Szymon Bobek, Dec 11, 2004
    #1
    1. Advertising

  2. Szymon Bobek

    Eric Boutin Guest

    [OT]Re: time.h

    On Sat, 11 Dec 2004 14:04:42 +0100, Szymon Bobek wrote :

    > Hello,
    > Is it possible to get time with precission to 1/100 of second using time.h?
    > If yes - how? If not - where should I search for function which can do it?
    >
    > Thanx,
    > Szymon



    first time.h is deprecated;
    you should use <ctime> instead;


    here's the reference for this header :
    http://www.cplusplus.com/ref/ctime/

    there's no miliseconds.. I think you'll have to be OS-specifics..

    if programming for POSIX, go read this :
    http://www.gnu.org/software/libc/manual/html_mono/libc.html#Date and Time


    If programming for Windows, the windows multimedia librairy have what you
    need. gettime or timegettime not shure... lookup msdn


    hope it helped

    --
    ========
    Eric Boutin
    Eric Boutin, Dec 11, 2004
    #2
    1. Advertising

  3. Szymon Bobek

    Jens Guest

    Re: [OT]Re: time.h

    Eric Boutin wrote:

    > On Sat, 11 Dec 2004 14:04:42 +0100, Szymon Bobek wrote :
    >
    >> Hello,
    >> Is it possible to get time with precission to 1/100 of second using
    >> time.h? If yes - how? If not - where should I search for function which
    >> can do it?
    >>
    >> Thanx,
    >> Szymon

    >
    >
    > first time.h is deprecated;
    > you should use <ctime> instead;
    >
    >
    > here's the reference for this header :
    > http://www.cplusplus.com/ref/ctime/
    >
    > there's no miliseconds.. I think you'll have to be OS-specifics..
    >
    > if programming for POSIX, go read this :
    >

    http://www.gnu.org/software/libc/manual/html_mono/libc.html#Date and Time
    >
    >
    > If programming for Windows, the windows multimedia librairy have what you
    > need. gettime or timegettime not shure... lookup msdn
    >
    >
    > hope it helped
    >

    Hi!

    You can uses something like this:

    while(){
    clock_t clockTemp = 0;
    clock_t clockA = clock();

    operationer

    clock_t clockB = clock();
    clockTemp += (clockB-clockA);
    }

    clockTemp/CLOCKS_PER_SEC;

    Jens
    Jens, Dec 12, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. engsol
    Replies:
    2
    Views:
    921
    Dan Bishop
    Jan 26, 2004
  2. Replies:
    8
    Views:
    457
    Magnus Lycka
    Aug 5, 2005
  3. Peter Hansen
    Replies:
    0
    Views:
    697
    Peter Hansen
    Feb 22, 2006
  4. Peter Hansen
    Replies:
    0
    Views:
    592
    Peter Hansen
    Feb 22, 2006
  5. flamesrock
    Replies:
    8
    Views:
    430
    Hendrik van Rooyen
    Nov 24, 2006
Loading...

Share This Page