You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boundary/internal/db/timestamp/timestamp.go

27 lines
499 B

package timestamp
import (
"time"
"google.golang.org/protobuf/types/known/timestamppb"
)
// New constructs a new Timestamp from the provided time.Time.
func New(t time.Time) *Timestamp {
return &Timestamp{
Timestamp: timestamppb.New(t),
}
}
// Now constructs a new Timestamp from the current time.
func Now() *Timestamp {
return &Timestamp{
Timestamp: timestamppb.Now(),
}
}
// AsTime converts x to a time.Time.
func (x *Timestamp) AsTime() time.Time {
return x.Timestamp.AsTime()
}