Typo
[openssl.git] / apps / apps.c
index 60bd7ef343a615f5410e05fadc575858c8cf6d02..be710a6adb1d76aea98c3977846fec672a9f85aa 100644 (file)
  *
  */
 
+#define _POSIX_C_SOURCE 2      /* On VMS, you need to define this to get
+                                  the declaration of fileno().  The value
+                                  2 is to make sure no function defined
+                                  in POSIX-2 is left undefined. */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -2375,6 +2379,7 @@ double app_tminterval(int stop,int usertime)
        FILETIME                now;
        double                  ret=0;
        static ULARGE_INTEGER   tmstart;
+       static int              warning=1;
 #ifdef _WIN32_WINNT
        static HANDLE           proc=NULL;
 
@@ -2395,6 +2400,13 @@ double app_tminterval(int stop,int usertime)
 #endif
                {
                SYSTEMTIME systime;
+
+               if (usertime && warning)
+                       {
+                       BIO_printf(bio_err,"To get meaningful results, run "
+                                          "this program on idle system.\n");
+                       warning=0;
+                       }
                GetSystemTime(&systime);
                SystemTimeToFileTime(&systime,&now);
                }
@@ -2410,8 +2422,97 @@ double app_tminterval(int stop,int usertime)
                tmstop.u.LowPart   = now.dwLowDateTime;
                tmstop.u.HighPart  = now.dwHighDateTime;
 
-               ret = (tmstop.QuadPart - tmstart.QuadPart)*1e-7;
+               ret = (__int64)(tmstop.QuadPart - tmstart.QuadPart)*1e-7;
+               }
+
+       return (ret);
+       }
+
+#elif defined(OPENSSL_SYSTEM_NETWARE)
+#include <time.h>
+
+double app_tminterval(int stop,int usertime)
+       {
+       double          ret=0;
+       static clock_t  tmstart;
+       static int      warning=1;
+
+       if (usertime && warning)
+               {
+               BIO_printf(bio_err,"To get meaningful results, run "
+                                  "this program on idle system.\n");
+               warning=0;
+               }
+
+       if (stop==TM_START)     tmstart = clock();
+       else                    ret     = (clock()-tmstart)/(double)CLOCKS_PER_SEC;
+
+       return (ret);
+       }
+
+#elif defined(OPENSSL_SYSTEM_VXWORKS)
+#include <time.h>
+
+double app_tminterval(int stop,int usertime)
+       {
+       double ret=0;
+#ifdef CLOCK_REALTIME
+       static struct timespec  tmstart;
+       struct timespec         now;
+#else
+       static unsigned long    tmstart;
+       unsigned long           now;
+#endif
+       static int warning=1;
+
+       if (usertime && warning)
+               {
+               BIO_printf(bio_err,"To get meaningful results, run "
+                                  "this program on idle system.\n");
+               warning=0;
+               }
+
+#ifdef CLOCK_REALTIME
+       clock_gettime(CLOCK_REALTIME,&now);
+       if (stop==TM_START)     tmstart = now;
+       else    ret = ( (now.tv_sec+now.tv_nsec*1e-9)
+                       - (tmstart.tv_sec+tmstart.tv_nsec*1e-9) );
+#else
+       now = tickGet();
+       if (stop==TM_START)     tmstart = now;
+       else                    ret = (now - tmstart)/(double)sysClkRateGet();
+#endif
+       return (ret);
+       }
+
+#elif defined(OPENSSL_SYSTEM_VMS)
+#include <time.h>
+#include <times.h>
+
+double app_tminterval(int stop,int usertime)
+       {
+       static clock_t  tmstart;
+       double          ret = 0;
+       clock_t         now;
+#ifdef __TMS
+       struct tms      rus;
+
+       now = times(&rus);
+       if (usertime)   now = rus.tms_utime;
+#else
+       if (usertime)
+               now = clock(); /* sum of user and kernel times */
+       else    {
+               struct timeval tv;
+               gettimeofday(&tv,NULL);
+               now = (clock_t)(
+                       (unsigned long long)tv.tv_sec*CLK_TCK +
+                       (unsigned long long)tv.tv_usec*(1000000/CLK_TCK)
+                       );
                }
+#endif
+       if (stop==TM_START)     tmstart = now;
+       else                    ret = (now - tmstart)/(double)(CLK_TCK);
 
        return (ret);
        }
@@ -2428,7 +2529,7 @@ double app_tminterval(int stop,int usertime)
 
        if (usertime)           now = rus.tms_utime;
 
-       if (stop==TMSTART)      tmstart = now;
+       if (stop==TM_START)     tmstart = now;
        else                    ret = (now - tmstart)/(double)sysconf(_SC_CLK_TCK);
 
        return (ret);
@@ -2448,7 +2549,7 @@ double app_tminterval(int stop,int usertime)
        if (usertime)           getrusage(RUSAGE_SELF,&rus), now = rus.ru_time;
        else                    gettimeofday(&now,NULL);
 
-       if (stop==TMSTART)      tmstart = now;
+       if (stop==TM_START)     tmstart = now;
        else                    ret = ( (now.tv_sec+now.tv_usec*1e-6)
                                        - (tmstart.tv_sec+tmstart.tv_usec*1e-6) );