3 /* time - time related syscal wrappers */
5 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
12 #include "xbt/sysdep.h"
13 #include "gras/virtu.h"
16 double gras_os_time() {
17 #ifdef HAVE_GETTIMEOFDAY
20 gettimeofday(&tv, NULL);
22 return (double)(tv.tv_sec + tv.tv_usec / 1000000);
25 return (double)(time(NULL));
26 #endif /* HAVE_GETTIMEOFDAY? */
30 void gras_os_sleep(unsigned long sec,unsigned long usec) {
32 if (usec/1000000) sleep(usec/1000000);
35 (void)usleep(usec % 1000000);
36 #endif /* ! HAVE_USLEEP */