Scheduler updates (#1311)
* Scheduler updates * Add convenience methods to db/timestamp.Timestamp * Remove recursive loop Co-authored-by: Michael Gaffney <mike@gaffney.cc>
This commit is contained in:
1 parent
aea1da77b6
commit
649ed32504
14 files changed
+214
-109
No files matched your search
@@ -0,0 +1,26 @@
|
||||
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()
|
||||
}
|
||||
Reference in new issue
Block a user