Eli Zaretskii's DOSish file name patches.
[deliverable/binutils-gdb.git] / gprof / hertz.c
index 75314acc0c3c0d76c70a21118f743ad74adc411b..a7fc14ed7f8cc8d8b3e5691eea4b4555ee9fd24b 100644 (file)
 #include "hertz.h"
 
 
-#ifdef __MSDOS__
-#define HERTZ 18
-#endif
-
 int
 hertz ()
 {
@@ -38,17 +34,19 @@ hertz ()
   tim.it_value.tv_usec = 0;
   setitimer (ITIMER_REAL, &tim, 0);
   setitimer (ITIMER_REAL, 0, &tim);
-  if (tim.it_interval.tv_usec < 2)
+  if (tim.it_interval.tv_usec >= 2)
     {
-      return HZ_WRONG;
+      return 1000000 / tim.it_interval.tv_usec;
     }
-  return 1000000 / tim.it_interval.tv_usec;
-#else /* ! defined (HAVE_SETITIMER) */
+#endif /* ! defined (HAVE_SETITIMER) */
 #if defined (HAVE_SYSCONF) && defined (_SC_CLK_TCK)
   return sysconf (_SC_CLK_TCK);
 #else /* ! defined (HAVE_SYSCONF) || ! defined (_SC_CLK_TCK) */
+#ifdef __MSDOS__
+  return 18;
+#else  /* ! defined (__MSDOS__) */
   return HZ_WRONG;
+#endif /* ! defined (__MSDOS__) */
 #endif /* ! defined (HAVE_SYSCONF) || ! defined (_SC_CLK_TCK) */
-#endif /* ! defined (HAVE_SETITIMER) */
 #endif /* ! defined (HERTZ) */
 }
This page took 0.024398 seconds and 4 git commands to generate.