I think that's how normal ntp works
Just ignore a value if it is not in the range [Q1-k(Q3-Q1),Q3+k(Q3-Q1)], where Q1 and Q3 are the 25th and 75th percentiles, k is a constant and to calculate a percentile you just do:
data_set = data_set.sort();
for (var i=0;i<data_set.length;i++){
if (i>=data_set.length*percentile/100){
answer = data_set[i];
break;
}
}
Yes, I just read all that on wikipedia