VOL-2532 add since filter

Change-Id: I8c17cc1dc26abbdcc61533892c276a3264910e39
diff --git a/VERSION b/VERSION
index ee90284..90a27f9 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.4
+1.0.5
diff --git a/internal/pkg/commands/events.go b/internal/pkg/commands/events.go
index b390987..b278f8d 100644
--- a/internal/pkg/commands/events.go
+++ b/internal/pkg/commands/events.go
@@ -47,6 +47,7 @@
 	Count    int    `short:"c" long:"count" default:"-1" value-name:"LIMIT" description:"Limit the count of messages that will be printed"`
 	Now      bool   `short:"n" long:"now" description:"Stop printing events when current time is reached"`
 	Timeout  int    `short:"t" long:"idle" default:"900" value-name:"SECONDS" description:"Timeout if no message received within specified seconds"`
+	Since    string `short:"s" long:"since" default:"" value-name:"TIMESTAMP" description:"Do not show entries before timestamp"`
 }
 
 type EventOpts struct {
@@ -95,6 +96,26 @@
 	}
 }
 
+func ParseSince(s string) (*time.Time, error) {
+	if strings.EqualFold(s, "now") {
+		since := time.Now()
+		return &since, nil
+	}
+
+	rfc3339Time, err := time.Parse(time.RFC3339, s)
+	if err == nil {
+		return &rfc3339Time, nil
+	}
+
+	duration, err := time.ParseDuration(s)
+	if err == nil {
+		since := time.Now().Add(-duration)
+		return &since, nil
+	}
+
+	return nil, fmt.Errorf("Unable to parse time specification `%s`. Please use either `now`, a duration, or an RFC3339-compliant string", s)
+}
+
 // Extract the header, as well as a few other items that might be of interest
 func DecodeHeader(md *desc.MessageDescriptor, b []byte, ts time.Time) (*EventHeader, error) {
 	m := dynamic.NewMessage(md)
@@ -390,6 +411,14 @@
 		return err
 	}
 
+	var since *time.Time
+	if options.Since != "" {
+		since, err = ParseSince(options.Since)
+		if err != nil {
+			return err
+		}
+	}
+
 	// Get signnal for finish
 	doneCh := make(chan struct{})
 	go func() {
@@ -409,6 +438,8 @@
 				}
 				if headerFilter != nil && !headerFilter.Evaluate(*hdr) {
 					// skip printing message
+				} else if since != nil && since.Unix() > hdr.Timestamp {
+					// it's too old
 				} else {
 					// comma separated between this message and predecessor
 					if count > 0 {