mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
isc_time_millidiff is now isc_time_microdiff
This commit is contained in:
@@ -130,12 +130,19 @@ isc_condition_waituntil(isc_condition_t *cond, isc_mutex_t *mutex,
|
|||||||
isc_time_t *t)
|
isc_time_t *t)
|
||||||
{
|
{
|
||||||
DWORD milliseconds;
|
DWORD milliseconds;
|
||||||
struct isc_time now;
|
isc_uint64_t microseconds;
|
||||||
|
isc_time_t now;
|
||||||
|
|
||||||
if (isc_time_now(&now) != ISC_R_SUCCESS) {
|
if (isc_time_now(&now) != ISC_R_SUCCESS) {
|
||||||
/* XXX */
|
/* XXX */
|
||||||
return (ISC_R_UNEXPECTED);
|
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));
|
return (wait(cond, mutex, milliseconds));
|
||||||
}
|
}
|
||||||
|
@@ -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)
|
* t >= epoch + i (comparing times, not pointers)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/***
|
isc_uint64_t
|
||||||
*** Win32 Only
|
isc_time_microdiff(isc_time_t *t1, isc_time_t *t2);
|
||||||
***/
|
|
||||||
|
|
||||||
unsigned int
|
|
||||||
isc_time_millidiff(isc_time_t *t1, isc_time_t *t2);
|
|
||||||
/*
|
/*
|
||||||
* Find the difference in milliseconds between time t1 and time t2.
|
* Find the difference in milliseconds between time t1 and time t2.
|
||||||
* t2 is the subtrahend of t1; ie, difference = t1 - 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.
|
* No formal requirements are asserted.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ISC_LANG_ENDDECLS
|
||||||
|
|
||||||
#endif /* ISC_TIME_H */
|
#endif /* ISC_TIME_H */
|
||||||
|
@@ -181,12 +181,8 @@ isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) {
|
|||||||
result->absolute.dwHighDateTime = i2.HighPart;
|
result->absolute.dwHighDateTime = i2.HighPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
isc_uint64_t
|
||||||
*** Win32 Only
|
isc_time_microdiff(isc_time_t *t1, isc_time_t *t2) {
|
||||||
***/
|
|
||||||
|
|
||||||
unsigned int
|
|
||||||
isc_time_millidiff(isc_time_t *t1, isc_time_t *t2) {
|
|
||||||
ULARGE_INTEGER i1, i2;
|
ULARGE_INTEGER i1, i2;
|
||||||
LONGLONG i3;
|
LONGLONG i3;
|
||||||
|
|
||||||
@@ -201,14 +197,9 @@ isc_time_millidiff(isc_time_t *t1, isc_time_t *t2) {
|
|||||||
return (0);
|
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! */
|
return (i3);
|
||||||
if (i3 > _MILLIMAX)
|
|
||||||
return (_MILLIMAX);
|
|
||||||
#undef _MILLIMAX
|
|
||||||
|
|
||||||
return ((unsigned int)(i3));
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user