Revision: 48462
http://brlcad.svn.sourceforge.net/brlcad/?rev=48462&view=rev
Author: brlcad
Date: 2012-01-12 00:35:08 +0000 (Thu, 12 Jan 2012)
Log Message:
-----------
Restructure and cleanup. conditionalize on feature instead of platform and
pull the logging statement into a fall-back case so we'll know at compile-time
if we end up in an undefined state. handles coverity UNREACHABLE issue (cid
1669).
Modified Paths:
--------------
brlcad/trunk/src/libbu/timer.c
Modified: brlcad/trunk/src/libbu/timer.c
===================================================================
--- brlcad/trunk/src/libbu/timer.c 2012-01-12 00:32:14 UTC (rev 48461)
+++ brlcad/trunk/src/libbu/timer.c 2012-01-12 00:35:08 UTC (rev 48462)
@@ -24,30 +24,36 @@
#include <time.h>
#include "bio.h"
-# ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-# endif
-# ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-# ifdef HAVE_SCHED_H
-# include <sched.h>
-# endif
-#if defined(_WIN32)
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SCHED_H
+# include <sched.h>
+#endif
+#ifdef HAVE_MMSYSTEM_H
# include <mmsystem.h>
-#endif /* !defined(_WIN32) */
+#endif
#include "bu.h"
-int64_t bu_gettime(void)
+
+int64_t
+bu_gettime(void)
{
-#if !defined(_WIN32)
+#ifdef HAVE_SYS_TIME_H
+
struct timeval nowTime;
gettimeofday(&nowTime, NULL);
return ((int64_t)nowTime.tv_sec * (int64_t)1000000
+ (int64_t)nowTime.tv_usec);
-#else /* !defined(_WIN32) */
+
+#else /* HAVE_SYS_TIME_H */
+# ifdef HAVE_MMSYSTEM_H
+
LARGE_INTEGER count;
static LARGE_INTEGER freq = {0};
@@ -64,10 +70,15 @@
return 1e6*count.QuadPart/freq.QuadPart;
-#endif /* !defined(_WIN32) */
+# else /* HAVE_MMSYSTEM_H */
+# warning "bu_gettime() implementation missing for this machine type"
- bu_log("This should never happen.\n");
+ bu_log("timer.c: WARNING, no gettime implementation for this machine
type.\n");
return -1;
+
+# endif /* HAVE_MMSYSTEM_H */
+#endif /* HAVE_SYS_TIME_H */
+
}
/*
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits