Small change to the gcc argument.
[eco.git] / time.c
blob9cfa459191c3c7cbd3dd63c5be5c3a2678e1b16e
1 /*
2 * Copyright (C) 2009 Diego Hernan Borghetti.
3 * Eco
4 */
6 #include <stdio.h>
7 #include <unistd.h>
8 #include <sys/time.h>
11 /* return the time in seconds. */
12 double e_time_get(void)
14 struct timeval tv;
16 gettimeofday(&tv, NULL);
17 return((double)tv.tv_sec + (((double)tv.tv_usec)/10000.0));
20 /* sleep 'ms' miliseconds. */
21 void e_sleep_ms(int ms)
23 if (ms >= 1000) {
24 sleep(ms/1000);
25 ms= (ms%1000);
27 usleep(ms*1000);