fix problem with time vals

This commit is contained in:
Mauro Palumbo 2019-06-04 17:10:57 +02:00
parent 208768c0e9
commit 75b7be302f
5 changed files with 9 additions and 11 deletions

@ -1 +1 @@
Subproject commit 474a6d902b1c41912b216c06a74085ff3b102bad
Subproject commit bfefac3a882b382bfb7ad749974930884da954a6

@ -1 +1 @@
Subproject commit 6ece47ba6438e7a6db5c7b85a68b3c16f0911871
Subproject commit 539c2d82534345c62ba9a20c2e98ea5cbdea9c7e

@ -1 +1 @@
Subproject commit e93235aa6e45820af7e23e97627845a7b2b3d919
Subproject commit 6501fef1fffc0b49dda59b3716b03034edcfeee6

2
doc

@ -1 +1 @@
Subproject commit 3db2ff8fa65f5acb3f7807a0302d5c81db1e2227
Subproject commit 7f64a90d86fc53506f93fb4c327fdb8c4e3aab0a

View file

@ -17,17 +17,15 @@
Val* proc_ntp_short(const NTP_Short_Time* t)
{
if ( t->seconds() == 0 && t->fractions() == 0 )
return new IntervalVal(0.0, Milliseconds);
return new IntervalVal((double)ntohl(t->seconds() + t->fractions()*FRAC_16), Milliseconds);
//return new IntervalVal((double)ntohs(t->seconds() + t->fractions()*FRAC_16), Seconds);
return new Val(0.0, TYPE_INTERVAL);
return new Val(t->seconds() + t->fractions()*FRAC_16, TYPE_INTERVAL);
}
Val* proc_ntp_timestamp(const NTP_Time* t)
{
if ( t->seconds() == 0 && t->fractions() == 0)
return new Val(0.0, TYPE_TIME);
return new IntervalVal((double)ntohl(EPOCH_OFFSET + t->seconds() + t->fractions()*FRAC_32), Milliseconds);
//return new IntervalVal((double)ntohs(EPOCH_OFFSET + t->seconds() + t->fractions()*FRAC_32), Seconds);
return new Val(EPOCH_OFFSET + t->seconds() + t->fractions()*FRAC_32, TYPE_TIME);
}
%}
@ -40,8 +38,8 @@ refine flow NTP_Flow += {
RecordVal* rv = new RecordVal(BifType::Record::NTP::std);
rv->Assign(0, val_mgr->GetCount(${nsm.stratum}));
rv->Assign(1, new IntervalVal(pow(2, ${nsm.poll}), Milliseconds));
rv->Assign(2, new IntervalVal(pow(2, ${nsm.precision}), Milliseconds));
rv->Assign(1, new Val(pow(2, ${nsm.poll}), TYPE_INTERVAL));
rv->Assign(2, new Val(pow(2, ${nsm.precision}), TYPE_INTERVAL));
rv->Assign(3, proc_ntp_short(${nsm.root_delay}));
rv->Assign(4, proc_ntp_short(${nsm.root_dispersion}));