// Reduce the timestamp to the previous midnight.
493930
func midnight(t uint64) (mid uint64) {
	if t > 0 {
		mid = t - t%aDay
	}
	return
}
611265
func (c *Conn) LastRdyTime() time.Time {
	return time.Unix(0, atomic.LoadInt64(&c.lastRdyTimestamp))
}
946087
func SleepUntil(t time.Time) {
	now := time.Now()
	if !t.After(now) {
		// t <= now, the time has passed
		return
	}
	time.Sleep(t.Sub(now))
}
78433
func TimestampNow() Timestamp {
	var year, day, hour, min, sec int
	var month time.Month
	year, month, day = time.Now().Date()
	hour, min, sec = time.Now().Clock()
	return Timestamp{
		Year:     year,
		Month:    int(month),
		Day:      day,
		Hour:     hour,
		Min:      min,
		Sec:      sec,
		MilliSec: 0,
		MicroSec: 0,
		NanoSec:  0,
		PicoSec:  0,
	}
}
1176855
func (s *DeliveryStreamDescription) SetLastUpdateTimestamp(v time.Time) *DeliveryStreamDescription {
	s.LastUpdateTimestamp = &v
	return s
}
116992
func (dtp *DefaultTimestampProvider) Now() Timestamp {
	return Timestamp{
		Time: uint64(time.Now().Unix()),
	}
}
1051969
func (s *LogStream) SetLastEventTimestamp(v int64) *LogStream {
	s.LastEventTimestamp = &v
	return s
}
1180523
func (c Context) Timestamp() Context {
	c.l = c.l.Hook(th)
	return c
}
1179856
func (s *HLSTimestampRange) SetStartTimestamp(v time.Time) *HLSTimestampRange {
	s.StartTimestamp = &v
	return s
}
1219645
func (s *RemediationExecutionStatus) SetLastUpdatedTime(v time.Time) *RemediationExecutionStatus {
	s.LastUpdatedTime = &v
	return s
}
932157
func medianAdjustedTime(chainState *blockchain.BestState, timeSource blockchain.MedianTimeSource) time.Time {
	// The timestamp for the block must not be before the median timestamp
	// of the last several blocks.  Thus, choose the maximum between the
	// current time and one second after the past median time.  The current
	// timestamp is truncated to a second boundary before comparison since a
	// block timestamp does not supported a precision greater than one
	// second.
	newTimestamp := timeSource.AdjustedTime()
	minTimestamp := MinimumMedianTime(chainState)
	if newTimestamp.Before(minTimestamp) {
		newTimestamp = minTimestamp
	}

	return newTimestamp
}
1037982
func Timestamp(ts time.Time) SampleOption {
	return func(s *SSFSample) {
		s.Timestamp = ts.UnixNano()
	}
}
172988
func (s *ResourcePolicy) SetLastUpdatedTime(v int64) *ResourcePolicy {
	s.LastUpdatedTime = &v
	return s
}
668727
func (s *ResourceShare) SetLastUpdatedTime(v time.Time) *ResourceShare {
	s.LastUpdatedTime = &v
	return s
}
726187
func TimestampLess(i *timestamp.Timestamp, j *timestamp.Timestamp) bool {
	if j == nil {
		return false
	}
	if i == nil {
		return true
	}
	if i.Seconds < j.Seconds {
		return true
	}
	if i.Seconds > j.Seconds {
		return false
	}
	return i.Nanos < j.Nanos
}
103013
func (c *ChatDeleteCall) Timestamp(timestamp string) *ChatDeleteCall {
	c.timestamp = timestamp
	return c
}
281802
func TimeToTimestamp(t time.Time) *timestamp.Timestamp {
	return &timestamp.Timestamp{
		Seconds: t.UnixNano() / int64(time.Second),
		Nanos:   int32(t.UnixNano() % int64(time.Second)),
	}
}