Back to index

glibc  2.9
clock.c File Reference
#include <sys/resource.h>
#include <sys/time.h>
#include <time.h>

Go to the source code of this file.


static clock_t timeval_to_clock_t (const struct timeval *tv)
clock_t clock (void)

Function Documentation

clock_t clock ( void  )

Definition at line 35 of file clock.c.

  struct rusage usage;

  if (__getrusage (RUSAGE_SELF, &usage) < 0)
    return (clock_t) -1;

  return (timeval_to_clock_t (&usage.ru_stime) +
         timeval_to_clock_t (&usage.ru_utime));

Here is the call graph for this function:

static clock_t timeval_to_clock_t ( const struct timeval tv) [static]

Definition at line 27 of file clock.c.

  return (clock_t) ((tv->tv_sec * CLOCKS_PER_SEC) +
                  (tv->tv_usec * CLOCKS_PER_SEC / 1000000));

Here is the caller graph for this function: