tgrekov-philosophers
HIVE philosophers July 2024
Loading...
Searching...
No Matches
timestamp.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* timestamp.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2024/07/23 04:46:29 by tgrekov #+# #+# */
9
/* Updated: 2024/07/25 10:23:38 by tgrekov ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
20
#include <sys/time.h>
21
27
unsigned
long
timestamp
(
void
)
28
{
29
static
unsigned
long
start = 0;
30
struct
timeval t;
31
32
gettimeofday(&t, 0);
33
if
(!start)
34
start = t.tv_sec * 1000 + t.tv_usec / 1000;
35
return
((t.tv_sec * 1000 + t.tv_usec / 1000) - start);
36
}
timestamp
unsigned long timestamp(void)
Millisecond timestamp since this function was first called.
Definition
timestamp.c:27
src
mandatory
utils
timestamp.c