Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix (c) dates; Initiate win32 cross-port
[simgrid.git] / src / gras / Virtu / rl_time.c
index fcd0b1a..9eee7d5 100644 (file)
@@ -2,22 +2,29 @@
 
 /* time - time related syscal wrappers                                      */
 
-/* Authors: Martin Quinson                                                  */
-/* Copyright (C) 2003,2004 da GRAS posse.                                   */
+/* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
 
 /* This program is free software; you can redistribute it and/or modify it
-   under the terms of the license (GNU LGPL) which comes with this package. */
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "portable.h"
 
 #include "xbt/sysdep.h"
 #include "gras/virtu.h"
-#include <sys/time.h>   /* gettimeofday() */
+
 
 double gras_os_time() {
+#ifdef HAVE_GETTIMEOFDAY
   struct timeval tv;
 
   gettimeofday(&tv, NULL);
 
   return (double)(tv.tv_sec * 1000000 + tv.tv_usec);
+#else
+  /* Poor resolution */
+  return (double)(time(NULL)); 
+#endif /* HAVE_GETTIMEOFDAY? */ 
+       
 }
  
 void gras_os_sleep(unsigned long sec,unsigned long usec) {