Skip to content

Commit 917b599

Browse files
authored
Revert "all: using the more elegant way to deal milliseconds and nanoseconds (#292)" (#306)
This reverts commit 9d6c353.
1 parent 9d6c353 commit 917b599

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

internal/api.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ func logf(c *aeContext, level int64, format string, args ...interface{}) {
550550
s = strings.TrimRight(s, "\n") // Remove any trailing newline characters.
551551
if logToLogservice() {
552552
c.addLogLine(&logpb.UserAppLogLine{
553-
TimestampUsec: proto.Int64(time.Now().UnixMicro()),
553+
TimestampUsec: proto.Int64(time.Now().UnixNano() / 1e3),
554554
Level: &level,
555555
Message: &s,
556556
})

log/log.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ func makeRequest(params *Query, appID, versionID string) (*pb.LogReadRequest, er
245245
req := &pb.LogReadRequest{}
246246
req.AppId = &appID
247247
if !params.StartTime.IsZero() {
248-
req.StartTime = proto.Int64(params.StartTime.UnixMicro())
248+
req.StartTime = proto.Int64(params.StartTime.UnixNano() / 1e3)
249249
}
250250
if !params.EndTime.IsZero() {
251-
req.EndTime = proto.Int64(params.EndTime.UnixMicro())
251+
req.EndTime = proto.Int64(params.EndTime.UnixNano() / 1e3)
252252
}
253253
if len(params.Offset) > 0 {
254254
var offset pb.LogOffset

search/search.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ func fieldsToProto(src []Field) ([]*pb.Field, error) {
977977
}
978978
timeFields[f.Name] = true
979979
fieldValue.Type = pb.FieldValue_DATE.Enum()
980-
fieldValue.StringValue = proto.String(strconv.FormatInt(x.UnixMilli(), 10))
980+
fieldValue.StringValue = proto.String(strconv.FormatInt(x.UnixNano()/1e6, 10))
981981
case float64:
982982
if numericFields[f.Name] {
983983
return nil, fmt.Errorf("search: duplicate numeric field %q", f.Name)

taskqueue/taskqueue.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func newAddReq(c context.Context, task *Task, queueName string) (*pb.TaskQueueAd
216216
req := &pb.TaskQueueAddRequest{
217217
QueueName: []byte(queueName),
218218
TaskName: []byte(task.Name),
219-
EtaUsec: proto.Int64(eta.UnixMicro()),
219+
EtaUsec: proto.Int64(eta.UnixNano() / 1e3),
220220
}
221221
method := task.method()
222222
if method == "PULL" {
@@ -467,7 +467,7 @@ func ModifyLease(c context.Context, task *Task, queueName string, leaseTime int)
467467
req := &pb.TaskQueueModifyTaskLeaseRequest{
468468
QueueName: []byte(queueName),
469469
TaskName: []byte(task.Name),
470-
EtaUsec: proto.Int64(task.ETA.UnixMicro()), // Used to verify ownership.
470+
EtaUsec: proto.Int64(task.ETA.UnixNano() / 1e3), // Used to verify ownership.
471471
LeaseSeconds: proto.Float64(float64(leaseTime)),
472472
}
473473
res := &pb.TaskQueueModifyTaskLeaseResponse{}

v2/taskqueue/taskqueue.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func newAddReq(c context.Context, task *Task, queueName string) (*pb.TaskQueueAd
216216
req := &pb.TaskQueueAddRequest{
217217
QueueName: []byte(queueName),
218218
TaskName: []byte(task.Name),
219-
EtaUsec: proto.Int64(eta.UnixMicro()),
219+
EtaUsec: proto.Int64(eta.UnixNano() / 1e3),
220220
}
221221
method := task.method()
222222
if method == "PULL" {
@@ -467,7 +467,7 @@ func ModifyLease(c context.Context, task *Task, queueName string, leaseTime int)
467467
req := &pb.TaskQueueModifyTaskLeaseRequest{
468468
QueueName: []byte(queueName),
469469
TaskName: []byte(task.Name),
470-
EtaUsec: proto.Int64(task.ETA.UnixMicro()), // Used to verify ownership.
470+
EtaUsec: proto.Int64(task.ETA.UnixNano() / 1e3), // Used to verify ownership.
471471
LeaseSeconds: proto.Float64(float64(leaseTime)),
472472
}
473473
res := &pb.TaskQueueModifyTaskLeaseResponse{}

0 commit comments

Comments
 (0)