blob: ca1c8594e01f077389e4b33ff72b5a4918087aa0 (
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
27
28
29
30
31
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sily_time_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kdx <kdx @student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/17 11:33:01 by kdx #+# #+# */
/* Updated: 2022/10/17 11:33:01 by kdx ### ########.fr */
/* */
/* ************************************************************************** */
#include "sily.h"
#include <sys/time.h>
t_u64 sily_get_time(void)
{
struct timeval te;
gettimeofday(&te, NULL);
return (te.tv_sec * 1000LL + te.tv_usec / 1000);
}
void sily_sleep(t_u64 millis)
{
t_u64 start;
start = sily_get_time();
while (sily_get_time() - start < millis)
;
}
|