Edit

kc3-lang/libressl/apps/apps_win.c

Branch :

  • Browse

    Commit

  • Author : Brent Cook
    Date : 2014-11-20 00:26:55
    Hash : 58fcd3c3
    Message : Add conditional compilation for windows and posix functions. This adds a Windows-specific versions of several symbols from libcrypto and openssl(1).

  • apps/apps_win.c
  • /*
     * Public domain
     *
     * Dongsheng Song <dongsheng.song@gmail.com>
     * Brent Cook <bcook@openbsd.org>
     */
    
    #include <windows.h>
    
    #include "apps.h"
    
    double
    app_tminterval(int stop, int usertime)
    {
    	static unsigned __int64 tmstart;
    	union {
    		unsigned __int64 u64;
    		FILETIME ft;
    	} ct, et, kt, ut;
    
    	GetProcessTimes(GetCurrentProcess(), &ct.ft, &et.ft, &kt.ft, &ut.ft);
    
    	if (stop == TM_START) {
    		tmstart = ut.u64 + kt.u64;
    	} else {
    		return (ut.u64 + kt.u64 - tmstart) / (double) 10000000;
    	}
    	return 0;
    }