diff options
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 | } | ||