// TimestampSend calls the stored procedure 'pg_catalog.timestamp_send(timestamp without time zone) bytea' on db.
423297
func TimestampSend(db XODB, v0 time.Time) ([]byte, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.timestamp_send($1)`

	// run query
	var ret []byte
	XOLog(sqlstr, v0)
	err = db.QueryRow(sqlstr, v0).Scan(&ret)
	if err != nil {
		return nil, err
	}

	return ret, nil
}
944634
func (t Timestamp) Parse() (time.Time, error) {
	return time.Parse(time.RFC3339, string(t))
}
39346
func (s *IndexService) Timestamp(timestamp string) *IndexService {
	s.timestamp = timestamp
	return s
}
870126
func Timestamp(t time.Time) uint64 {
	return uint64(t.Unix())*1000 +
		uint64(t.Nanosecond()/int(time.Millisecond))
}
221224
func Timestamp(val string) (*timestamp.Timestamp, error) {
	var r *timestamp.Timestamp
	err := jsonpb.UnmarshalString(val, r)
	return r, err
}
180450
func (s *GetSubscriptionDefinitionOutput) SetLastUpdatedTimestamp(v string) *GetSubscriptionDefinitionOutput {
	s.LastUpdatedTimestamp = &v
	return s
}
48518
func (ev *EventObject) Timestamp() int {
	ms := ev.Get("timeStamp").Int()
	s := ms / 1000
	// ns := (ms % 1000 * 1e6)
	// return time.Unix(int64(s), int64(ns))
	return s
}
1113032
func NTPToTime(v uint64) time.Time {
	if v == 0 {
		return time.Time{}
	}
	return time.Unix(int64(v-ntpDelta), 0)
}
744315
func TimestamptzEq(db XODB, v0 time.Time, v1 time.Time) (bool, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.timestamptz_eq($1, $2)`

	// run query
	var ret bool
	XOLog(sqlstr, v0, v1)
	err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
	if err != nil {
		return false, err
	}

	return ret, nil
}
104167
func parseTimestamp(data []byte) (uint64, error) {
	if len(data) != timestampBase32Len {
		return 0, fmt.Errorf("timestamp must be 35 bits, was %d",
			len(data)*5)
	}

	return base32ToUint64(data)
}
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,
	}
}
1137850
func encodeTimestamp(buf *bytes.Buffer, name string, val Timestamp) error {
	// type
	if err := buf.WriteByte(_TIMESTAMP); err != nil {
		return err
	}

	// name
	if err := writeCstring(buf, name); err != nil {
		return err
	}

	// value
	return binary.Write(buf, binary.LittleEndian, uint64(val))
}
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
}
975901
func (g *GossipSyncer) sendGossipTimestampRange(firstTimestamp time.Time,
	timestampRange uint32) error {

	endTimestamp := firstTimestamp.Add(
		time.Duration(timestampRange) * time.Second,
	)

	log.Infof("GossipSyncer(%x): applying gossipFilter(start=%v, end=%v)",
		g.cfg.peerPub[:], firstTimestamp, endTimestamp)

	localUpdateHorizon := &lnwire.GossipTimestampRange{
		ChainHash:      g.cfg.chainHash,
		FirstTimestamp: uint32(firstTimestamp.Unix()),
		TimestampRange: timestampRange,
	}

	if err := g.cfg.sendToPeer(localUpdateHorizon); err != nil {
		return err
	}

	if firstTimestamp == zeroTimestamp && timestampRange == 0 {
		g.localUpdateHorizon = nil
	} else {
		g.localUpdateHorizon = localUpdateHorizon
	}

	return nil
}
644120
func addTimestamp(buffer *bytes.Buffer) {
	now := now()
	year, month, day := now.Date()
	hour, minute, second := now.Clock()

	var tmp = new([23]byte)
	writeInt(tmp, 4, 0, year)
	tmp[4] = '-'
	writeInt(tmp, 2, 5, int(month))
	tmp[7] = '-'
	writeInt(tmp, 2, 8, day)
	tmp[10] = ' '
	writeInt(tmp, 2, 11, hour)
	tmp[13] = ':'
	writeInt(tmp, 2, 14, minute)
	tmp[16] = ':'
	writeInt(tmp, 2, 17, second)
	tmp[19] = '.'
	writeInt(tmp, 3, 20, now.Nanosecond()/1000000)
	buffer.Write(tmp[:])
}
636573
func (c *ChannelsHistoryCall) Timestamp(timestamp string) *ChannelsHistoryCall {
	c.timestamp = timestamp
	return c
}
809951
func ParseTimestamp(str string) (Time, error) {
	return ParseTime(str, mysql.TypeTimestamp, DefaultFsp)
}