func (sd sortableDurations) Average() time.Duration {
	all := time.Duration(0)
	for _, d := range sd {
		all += d
	}
	return time.Duration(all / time.Duration(len(sd)))
}
Returns an average of all durations
package timesync
import (
	"encoding/binary"
	"fmt"
	"net"
	"sort"
	"time"
	"github.com/libonomy/libonomy-light/log"
	"github.com/libonomy/libonomy-light/rand"
	"github.com/libonomy/libonomy-light/timesync/config"
)
const (
	MaxAllowedMessageDrift = 10 * time.Minute
	NtpOffset = 2208988800
	DefaultNtpPort = "123"
	MaxRequestTries = 3
	RequestTriesInterval = time.Second * 5
	MinResultsThreshold = 3
)
var (
	DefaultServers = []string{
		"time-a-wwv.nist.gov",
		"time-b-wwv.nist.gov",
		"time-c-wwv.nist.gov",
		"time.google.com",
		"time1.google.com",
		"time3.google.com",
		"time4.google.com",
		"time.asia.apple.com",
		"time.americas.apple.com",
	}
	zeroDuration = time.Duration(0)
	zeroTime     = time.Time{}
	zeroNtp      = NtpPacket{}
	ntpFunc = ntpRequest
)
type sortableDurations []time.Duration
func (sd sortableDurations) Len() int           { return len(sd) }
func (sd sortableDurations) Less(i, j int) bool { return sd[i] < sd[j] }
func (sd sortableDurations) Swap(i, j int)      { sd[i], sd[j] = sd[j], sd[i] }
func (sd *sortableDurations) RemoveExtremes() {
	s := *sd
	l := len(s)
	sort.Sort(sd)
	*sd = (*sd)[1 : l-1]
}