#include <stddef.h>
#include "timer.h"
#include <sys/time.h>

static double timer_start = 0.0;

void StartTimer() {
    struct timeval tv;
    gettimeofday(&tv, NULL);
    timer_start = tv.tv_sec * 1000.0 + tv.tv_usec / 1000.0;
}

double GetTimer() {
    struct timeval tv;
    gettimeofday(&tv, NULL);
    double timer_end = tv.tv_sec * 1000.0 + tv.tv_usec / 1000.0;
    return timer_end - timer_start;
}
