aboutsummaryrefslogtreecommitdiff
path: root/src/clock.c
blob: 7cb5ec3fa50a3426aebedaf763ac585abb223dd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "sys/time.h"

#include "clock.h"


Size clock_get_us( void )
{
  static struct timeval tv;
  gettimeofday( &tv, 0 );
  return (tv.tv_sec * 1000000) + tv.tv_usec;
}

f64 clock_get_s_hires( void )
{
  static struct timeval tv;
  gettimeofday( &tv, 0 );
  return (f64)((f64)tv.tv_sec + ((f64)tv.tv_usec / 1000000));
}