Package list libcryptx-perl / 2821a78
fortuna fix Karel Miko 3 years ago
1 changed file(s) with 9 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
66 * guarantee it works.
77 */
88 #include "tomcrypt.h"
9
10 #if defined(_WIN32)
11 #include <windows.h>
12 #else
13 #include <sys/time.h>
14 #endif
915
1016 /**
1117 @file fortuna.c
7581 GetSystemTimeAsFileTime(&CurrentTime);
7682 ul.LowPart = CurrentTime.dwLowDateTime;
7783 ul.HighPart = CurrentTime.dwHighDateTime;
78 cur_time = ul.QuadPart;
79 cur_time -= CONST64(116444736000000000); /* subtract epoch in microseconds */
80 cur_time /= 1000; /* nanoseconds -> microseconds */
84 cur_time = ul.QuadPart; /* now we have 100ns intervals since 1 January 1601 */
85 cur_time -= CONST64(116444736000000000); /* subtract 100ns intervals between 1601-1970 */
86 cur_time /= 10; /* 100ns intervals > microseconds */
8187 #endif
8288 return cur_time / 100;
8389 }