func (win *Window) RecordInWindow(rec *Record) (bool, error) {
	t, err := rec.ParseTime(win.timeIndex)
	if err != nil {
		return false, fmt.Errorf("recordinwindow: %v", err)
	}
	return win.InWindow(t), nil
}
RecordInWindow returns true if the record is in the Window.
Errors are possible from parsing the BaseDateTime field of the
Record.
package ais
import (
	"bytes"
	"fmt"
	"time"
)
type Window struct {
	leftMarker, rightMarker time.Time
	timeIndex               int
	width                   time.Duration
	Data                    map[uint64]*Record
}
func NewWindow(rs *RecordSet, width time.Duration) (*Window, error) {
	win := new(Window)
	timeIndex, ok := rs.Headers().Contains("BaseDateTime")
	if !ok {
		return nil, fmt.Errorf("newwindow: headers does not contain BaseDateTime")
	}
	win.SetIndex(timeIndex)
	rec, err := rs.readFirst()
	if err != nil {
		return nil, fmt.Errorf("newwindow: %v", err)
	}
	t, err := time.Parse(TimeLayout, (*rec)[timeIndex])
	if err != nil {
		return nil, fmt.Errorf("newwindow: %v", err)
	}
	win.SetLeft(t)
	win.SetWidth(width)
	win.SetRight(win.Left().Add(win.Width()))
	return win, nil
}
func (win *Window) Left() time.Time { return win.leftMarker }
func (win *Window) SetLeft(marker time.Time) {
	win.leftMarker = marker
}
func (win *Window) Right() time.Time { return win.rightMarker }
func (win *Window) SetRight(marker time.Time) {
	win.rightMarker = marker
}
func (win *Window) Width() time.Duration { return win.width }
func (win *Window) SetWidth(dur time.Duration) {
	win.width = dur
}
func (win *Window) SetIndex(index int) {
	win.timeIndex = index
}
func (win *Window) AddRecord(rec Record) {
	if win.Data == nil {
		win.Data = make(map[uint64]*Record)
	}
	h := rec.Hash()
	win.Data[h] = &rec
}
func (win *Window) InWindow(t time.Time) bool {
	if win.leftMarker.Equal(t) {
		return true
	}
	return win.leftMarker.Before(t) && t.Before(win.rightMarker)
}