From: Theodore Tso Date: Wed, 28 Feb 1996 05:05:58 +0000 (+0000) Subject: Add Windows 95/NT time function. (Does this time function work under X-Git-Tag: krb5-1.0-beta6~434 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=37657fbefc2c9f8ed59bd42ffabeec2f27a57f47;p=krb5.git Add Windows 95/NT time function. (Does this time function work under Windows? We'll find out....) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7564 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/os/ChangeLog b/src/lib/crypto/os/ChangeLog index 8190c36ef..d9bb87bbf 100644 --- a/src/lib/crypto/os/ChangeLog +++ b/src/lib/crypto/os/ChangeLog @@ -1,3 +1,9 @@ +Sat Feb 24 00:34:15 1996 Theodore Y. Ts'o + + * c_ustime.c (krb5_crypto_us_timeofday): Add Windows 95/NT time + function. (Does this time function work under Windows? + We'll find out....) + Thu Feb 15 10:57:27 1996 Ezra Peisach * c_localaddr.c: Set magic number in krb5_address. diff --git a/src/lib/crypto/os/c_ustime.c b/src/lib/crypto/os/c_ustime.c index 51c90767d..2adceaa33 100644 --- a/src/lib/crypto/os/c_ustime.c +++ b/src/lib/crypto/os/c_ustime.c @@ -121,6 +121,44 @@ krb5_crypto_us_timeofday(seconds, microseconds) } +#elif defined(WIN32) || defined(_WINDOWS) + + /* Microsoft Windows NT and 95 (32bit) */ + /* This one works for WOW (Windows on Windows, ntvdm on Win-NT) */ + +#include +#include +#include + +krb5_error_code +krb5_crypto_us_timeofday(seconds, microseconds) +register krb5_int32 *seconds, *microseconds; +{ + struct _timeb timeptr; + krb5_int32 sec, usec; + static krb5_int32 last_sec = 0; + static krb5_int32 last_usec = 0; + + _ftime(&timeptr); /* Get the current time */ + sec = timeptr.time; + usec = timeptr.millitm; + + if (sec == last_sec) { /* Same as last time??? */ + usec = ++last_usec; /* Yep, so do microseconds */ + if (usec >= 1000000) { + ++sec; + usec = 0; + } + } + last_sec = sec; /* Remember for next time */ + last_usec = usec; + + *seconds = sec; /* Return the values */ + *microseconds = usec; + + return 0; +} + #elif defined (_MSDOS)