fixed bug in overlay_gettime_ms() (start time was 32bits not 64bits,

so strange behaviour resulted, breaking dna number lookup).
This commit is contained in:
gardners 2012-05-18 12:55:15 +09:30
parent e870c35422
commit 4ddb7a5572

View File

@ -45,15 +45,19 @@ unsigned int overlay_sequence_number=0;
/* Do we need to repeat our abbreviation policy? */ /* Do we need to repeat our abbreviation policy? */
int overlay_interface_repeat_abbreviation_policy[OVERLAY_MAX_INTERFACES]={1}; int overlay_interface_repeat_abbreviation_policy[OVERLAY_MAX_INTERFACES]={1};
/* Return milliseconds since server started. First call will always return zero. */ /* Return milliseconds since server started. First call will always return zero.
Must use long long, not time_t, as time_t can be 32bits, which is too small for
milli-seconds since 1970. */
long long overlay_sequence_start_time = 0;
long long overlay_gettime_ms() long long overlay_gettime_ms()
{ {
static time_t overlay_sequence_start_time = 0; long long now;
long long now = gettime_ms();
if (!overlay_sequence_start_time) { if (!overlay_sequence_start_time) {
overlay_sequence_start_time = now; overlay_sequence_start_time = gettime_ms();
now = 0; now = 0;
} } else
now= gettime_ms()-overlay_sequence_start_time;
return now; return now;
} }