aboutsummaryrefslogtreecommitdiff
path: root/src/timer.c
blob: 3a763a0d26c9e07e7b16e5c6a48c5cd9bc5d66a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
 * @file timer.c
 * @author Gertjan van den Burg
 * @date January, 2014
 * @brief Function for calculating time difference
 *
 * @details
 * This file contains a simple function for calculating the time in seconds
 * elapsed between two clock() calls.
 */

#include <time.h>

#include "timer.h"

/**
 * @brief Calculate the time between two clocks
 *
 * @param[in] 	s_time 	starting time
 * @param[in] 	e_time 	end time
 * @returns 		time elapsed in seconds
 */
double elapsed_time(clock_t s_time, clock_t e_time)
{
	return ((double) (e_time - s_time))/((double) CLOCKS_PER_SEC);
}