#include "codexion.h" # include // for getimeofday() long time_ms(void) { long current_time_ms; struct timeval current_t; gettimeofday(¤t_t, NULL); current_time_ms = current_t.tv_sec * 1000L + current_t.tv_usec / 1000L; return (current_time_ms); } void start_timer(t_sim *sim) { sim->start_time = time_ms(); } int get_rel_time(t_sim *sim) { int current_rel_time; long start_time; (void)pthread_mutex_lock(&sim->mutex_start_time); start_time = sim->start_time; (void)pthread_mutex_unlock(&sim->mutex_start_time); current_rel_time = time_ms() - start_time; return (current_rel_time); }