1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Add time interval filtering to downloader.

This commit is contained in:
Sascha L. Teichmann 2023-07-26 03:22:33 +02:00
parent 0e297fc616
commit de0599ebe3
4 changed files with 36 additions and 12 deletions

View file

@ -79,3 +79,8 @@ func (tr *TimeRange) UnmarshalText(text []byte) error {
*tr = NewTimeInterval(start, end)
return nil
}
// Contains return true if the given time is inside this time interval.
func (tr TimeRange) Contains(t time.Time) bool {
return !(t.Before(tr[0]) || t.After(tr[1]))
}