aboutsummaryrefslogtreecommitdiff
path: root/apps/s_time.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2001-09-28 10:34:48 +0000
committerRichard Levitte <levitte@openssl.org>2001-09-28 10:34:48 +0000
commita4a8f7b3eff1700c50a3bbbd36fc319916da3e04 (patch)
tree0fc74ac167f697731a92aa4d2d6c855f1c9bf5d6 /apps/s_time.c
parent34c66925aad7d10c034b0ddce99e1bfcf9a04ea8 (diff)
downloadopenssl-a4a8f7b3eff1700c50a3bbbd36fc319916da3e04.zip
openssl-a4a8f7b3eff1700c50a3bbbd36fc319916da3e04.tar.gz
openssl-a4a8f7b3eff1700c50a3bbbd36fc319916da3e04.tar.bz2
Change HZ in speed to rely on sysconf() if the clock tick is available
that way. Synchronise s_time with these changes.
Diffstat (limited to 'apps/s_time.c')
-rw-r--r--apps/s_time.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/apps/s_time.c b/apps/s_time.c
index 0e2f456..3b6c808 100644
--- a/apps/s_time.c
+++ b/apps/s_time.c
@@ -67,20 +67,21 @@
#include <stdlib.h>
#include <string.h>
+#define USE_SOCKETS
+#include "apps.h"
#ifdef OPENSSL_NO_STDIO
#define APPS_WIN16
#endif
-#define USE_SOCKETS
#include <openssl/x509.h>
#include <openssl/ssl.h>
#include <openssl/pem.h>
-#include "apps.h"
#include "s_apps.h"
#include <openssl/err.h>
#ifdef WIN32_STUFF
#include "winmain.h"
#include "wintext.h"
#endif
+#include OPENSSL_UNISTD
#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
#define TIMES
@@ -119,11 +120,19 @@
/* The following if from times(3) man page. It may need to be changed
*/
#ifndef HZ
-#ifndef CLK_TCK
-#define HZ 100.0
-#else /* CLK_TCK */
-#define HZ ((double)CLK_TCK)
-#endif
+# ifdef _SC_CLK_TCK
+# define HZ ((double)sysconf(_SC_CLK_TCK))
+# else
+# ifndef CLK_TCK
+# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
+# define HZ 100.0
+# else /* _BSD_CLK_TCK_ */
+# define HZ ((double)_BSD_CLK_TCK_)
+# endif
+# else /* CLK_TCK */
+# define HZ ((double)CLK_TCK)
+# endif
+# endif
#endif
#undef PROG