Skip to content

Commit

Permalink
EVENT: Add Timestamp to event struct.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cian911 committed Jan 9, 2022
1 parent 71fed6d commit 83f024f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Event struct {
// IsDir is the new create vent a directory
IsDir bool
// Timestamp in unix time epoch
Timestamp int64
Timestamp time.Time
}

// New creates and returns a new event struct
Expand All @@ -34,7 +34,7 @@ func New(file, path, dest, ext string) *Event {
Path: path,
Destination: dest,
Ext: ext,
Timestamp: time.Now().Unix(),
Timestamp: time.Now(),
}
}

Expand All @@ -48,7 +48,7 @@ func (e *Event) Move(path, file string) error {

// IsValidEvent checks if the event operation and file extension is valid
func (e *Event) IsValidEvent(ext string) bool {
if ext == e.Ext && e.Operation == "CREATE" {
if ext == e.Ext && e.Operation == "CREATE" || e.Operation == "WRITE" {
return true
}

Expand Down

0 comments on commit 83f024f

Please sign in to comment.