// LastEventTime is the time of the last task event in the allocation.
// It is used to determine allocation failure time. If the FinishedAt field
// is not set, the alloc's modify time is used
508742
func (a *Allocation) LastEventTime() time.Time {
	var lastEventTime time.Time
	if a.TaskStates != nil {
		for _, s := range a.TaskStates {
			if lastEventTime.IsZero() || s.FinishedAt.After(lastEventTime) {
				lastEventTime = s.FinishedAt
			}
		}
	}

	if lastEventTime.IsZero() {
		return time.Unix(0, a.ModifyTime).UTC()
	}
	return lastEventTime
}
584194
func getLastCfEventTimestamp(stackName string, conn *cloudformation.CloudFormation) (
	*time.Time, error) {
	output, err := conn.DescribeStackEvents(&cloudformation.DescribeStackEventsInput{
		StackName: aws.String(stackName),
	})
	if err != nil {
		return nil, err
	}

	return output.StackEvents[0].Timestamp, nil
}
875342
func Time(from time.Time, maxDelta time.Duration) time.Time {
	globalLk.Lock()
	defer globalLk.Unlock()
	return globalGen.Time(from, maxDelta)
}
857103
func (s *ConfigurationRecorderStatus) SetLastStopTime(v time.Time) *ConfigurationRecorderStatus {
	s.LastStopTime = &v
	return s
}
181657
func (s *LoggingStatus) SetLastFailureTime(v time.Time) *LoggingStatus {
	s.LastFailureTime = &v
	return s
}
1271516
func (s *Fleet) SetLastDeploymentTime(v time.Time) *Fleet {
	s.LastDeploymentTime = &v
	return s
}
232256
func (s *PartitionInput) SetLastAnalyzedTime(v time.Time) *PartitionInput {
	s.LastAnalyzedTime = &v
	return s
}
1235232
func (s *Robot) SetLastDeploymentTime(v time.Time) *Robot {
	s.LastDeploymentTime = &v
	return s
}
522690
func (mc MongoClient) EventsOlderThanAge(age int64) ([]contract.Event, error) {
	expireDate := (db.MakeTimestamp()) - age
	return mc.mapEvents(mc.getEvents(bson.M{"created": bson.M{"$lt": expireDate}}))
}
549067
func (n *Notification) GetLastReadAt() time.Time {
	if n == nil || n.LastReadAt == nil {
		return time.Time{}
	}
	return *n.LastReadAt
}
174633
func (c *Client) EventsByCreationTime(startTime, endTime int64, limit int) (events []contract.Event, err error) {
	conn := c.Pool.Get()
	defer conn.Close()

	objects, err := getObjectsByScore(conn, db.EventsCollection+":created", startTime, endTime, limit)
	if err != nil {
		if err != redis.ErrNil {
			return events, err
		}
	}

	events = make([]contract.Event, len(objects))
	err = unmarshalEvents(objects, events)
	if err != nil {
		return events, err
	}

	return events, nil
}
588478
func (d *driverPluginClient) TaskEvents(ctx context.Context) (<-chan *TaskEvent, error) {
	req := &proto.TaskEventsRequest{}

	// Join the passed context and the shutdown context
	joinedCtx, _ := joincontext.Join(ctx, d.doneCtx)

	stream, err := d.client.TaskEvents(joinedCtx, req)
	if err != nil {
		return nil, grpcutils.HandleReqCtxGrpcErr(err, ctx, d.doneCtx)
	}

	ch := make(chan *TaskEvent, 1)
	go d.handleTaskEvents(ctx, ch, stream)
	return ch, nil
}
820610
func JobFinishedEvent(payload string, didSucceed bool) {
	value := 0
	if didSucceed {
		value = 1
	}
	log.GaugeIntD(jobFinished, value, M{
		"payload": payload,
		"success": didSucceed,
	})
}
978950
func (e *Eventer) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error) {
	consumer := e.newConsumer(ctx)
	return consumer.ch, nil
}
242158
func (c *Context) postEvent(events ...types.BaseEvent) {
	m := Map.EventManager()
	c.WithLock(m, func() {
		for _, event := range events {
			m.PostEvent(c, &types.PostEvent{EventToPost: event})
		}
	})
}
348994
func (s *ConfigExportDeliveryInfo) SetLastAttemptTime(v time.Time) *ConfigExportDeliveryInfo {
	s.LastAttemptTime = &v
	return s
}
970306
func (_m *DBClient) EventsByCreationTime(startTime int64, endTime int64, limit int) ([]models.Event, error) {
	ret := _m.Called(startTime, endTime, limit)

	var r0 []models.Event
	if rf, ok := ret.Get(0).(func(int64, int64, int) []models.Event); ok {
		r0 = rf(startTime, endTime, limit)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]models.Event)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(int64, int64, int) error); ok {
		r1 = rf(startTime, endTime, limit)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}