package_stats.go 555 B

123456789101112131415161718192021222324252627
  1. // +build ignore
  2. package server
  3. import (
  4. "time"
  5. )
  6. // packageStats represent the stats we need for a package.
  7. // It has sending time and the size of the package.
  8. type packageStats struct {
  9. sendingTime time.Time
  10. size int
  11. }
  12. // NewPackageStats creates a pacakgeStats and return the pointer to it.
  13. func NewPackageStats(now time.Time, size int) *packageStats {
  14. return &packageStats{
  15. sendingTime: now,
  16. size: size,
  17. }
  18. }
  19. // Time return the sending time of the package.
  20. func (ps *packageStats) Time() time.Time {
  21. return ps.sendingTime
  22. }