diff options
author | Brent Cook <busterb@gmail.com> | 2014-11-20 00:26:55 -0600 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2014-12-03 17:02:29 -0600 |
commit | 58fcd3c39c73d83eb9782a8ef935498b18b5ae73 (patch) | |
tree | 523e55877fe8f38cc99ce8fdb633d9db9fe513e9 /apps | |
parent | 7f0646f612f61792bc3f922233c85bd205130216 (diff) | |
download | portable-58fcd3c39c73d83eb9782a8ef935498b18b5ae73.tar.gz portable-58fcd3c39c73d83eb9782a8ef935498b18b5ae73.tar.bz2 portable-58fcd3c39c73d83eb9782a8ef935498b18b5ae73.zip |
Add conditional compilation for windows and posix functions.
This adds a Windows-specific versions of several symbols from libcrypto
and openssl(1).
Diffstat (limited to 'apps')
-rw-r--r-- | apps/apps_win.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/apps/apps_win.c b/apps/apps_win.c new file mode 100644 index 0000000..496ac03 --- /dev/null +++ b/apps/apps_win.c | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * | ||
4 | * Dongsheng Song <dongsheng.song@gmail.com> | ||
5 | * Brent Cook <bcook@openbsd.org> | ||
6 | */ | ||
7 | |||
8 | #include <windows.h> | ||
9 | |||
10 | #include "apps.h" | ||
11 | |||
12 | double | ||
13 | app_tminterval(int stop, int usertime) | ||
14 | { | ||
15 | static unsigned __int64 tmstart; | ||
16 | union { | ||
17 | unsigned __int64 u64; | ||
18 | FILETIME ft; | ||
19 | } ct, et, kt, ut; | ||
20 | |||
21 | GetProcessTimes(GetCurrentProcess(), &ct.ft, &et.ft, &kt.ft, &ut.ft); | ||
22 | |||
23 | if (stop == TM_START) { | ||
24 | tmstart = ut.u64 + kt.u64; | ||
25 | } else { | ||
26 | return (ut.u64 + kt.u64 - tmstart) / (double) 10000000; | ||
27 | } | ||
28 | return 0; | ||
29 | } | ||