2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

isc_time_millidiff is now isc_time_microdiff

This commit is contained in:
David Lawrence
1999-10-09 02:39:53 +00:00
parent 91c49d591c
commit d3e7d196cd
3 changed files with 18 additions and 22 deletions

View File

@@ -130,12 +130,19 @@ isc_condition_waituntil(isc_condition_t *cond, isc_mutex_t *mutex,
isc_time_t *t)
{
DWORD milliseconds;
struct isc_time now;
isc_uint64_t microseconds;
isc_time_t now;
if (isc_time_now(&now) != ISC_R_SUCCESS) {
/* XXX */
return (ISC_R_UNEXPECTED);
}
milliseconds = (DWORD)isc_time_millidiff(t, &now);
microseconds = isc_time_microdiff(t, &now);
if (microseconds > 0xFFFFFFFFi64 * 1000)
milliseconds = 0xFFFFFFFF;
else
milliseconds = (DWORD)(microseconds / 1000);
return (wait(cond, mutex, milliseconds));
}

View File

@@ -183,12 +183,8 @@ isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result);
* t >= epoch + i (comparing times, not pointers)
*/
/***
*** Win32 Only
***/
unsigned int
isc_time_millidiff(isc_time_t *t1, isc_time_t *t2);
isc_uint64_t
isc_time_microdiff(isc_time_t *t1, isc_time_t *t2);
/*
* Find the difference in milliseconds between time t1 and time t2.
* t2 is the subtrahend of t1; ie, difference = t1 - t2.
@@ -197,4 +193,6 @@ isc_time_millidiff(isc_time_t *t1, isc_time_t *t2);
* No formal requirements are asserted.
*/
ISC_LANG_ENDDECLS
#endif /* ISC_TIME_H */

View File

@@ -181,12 +181,8 @@ isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) {
result->absolute.dwHighDateTime = i2.HighPart;
}
/***
*** Win32 Only
***/
unsigned int
isc_time_millidiff(isc_time_t *t1, isc_time_t *t2) {
isc_uint64_t
isc_time_microdiff(isc_time_t *t1, isc_time_t *t2) {
ULARGE_INTEGER i1, i2;
LONGLONG i3;
@@ -201,14 +197,9 @@ isc_time_millidiff(isc_time_t *t1, isc_time_t *t2) {
return (0);
/*
* Convert to milliseconds.
* Convert to microseconds.
*/
i3 = (i1.QuadPart - i2.QuadPart) / 10000;
i3 = (i1.QuadPart - i2.QuadPart) / 10;
#define _MILLIMAX 1000000000 /* XXX arbitrary! */
if (i3 > _MILLIMAX)
return (_MILLIMAX);
#undef _MILLIMAX
return ((unsigned int)(i3));
return (i3);
}