LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Miliseconds in c (https://www.linuxquestions.org/questions/programming-9/miliseconds-in-c-22873/)

ChimpFace9000 06-07-2002 09:10 PM

Miliseconds in c
 
In c, i know how to get the secs, mins and hours. But how do i get the miliseconds?

acid_kewpie 06-08-2002 03:49 AM

when i'm on time apps at theat speed i use gettimeofday() functions, which give microseconds, let alone milliseconds:

Code:

struct timeval times[SAMPLES];

  for ( i = 0 ; i < SAMPLES ; i++ ) {
    gettimeofday( &times[i], NULL);
  set_pin(LP_PIN17);
  }

time = times[i].tv_usec - times[0].tv_usec;

well thats a few snippets of me using it... check the man page for more info


All times are GMT -5. The time now is 02:43 AM.