Hello there,
We are currently using protoc 3.6.1 and planning to migrate to 4.x
During our POC on this migration we found timestamp returned using our existing code has differed from the format we were using, digging further we dont know what exactly caused the problem.
Timeformat received with 3.6.1 => "time": "2020-07-31T07:13:07.396733914Z",
Timeformat received with 4.0.0 => "time": {
"seconds": "1596871176",
"nanos": 363018229
},
Code:
partner.proto
------------------------------------------------
message ResponsePartnerEmployeeList {
......
google.protobuf.Timestamp time = 3;
}
partner.pg.go file (protoc 3.6.1 version created)
-----------------------------------------------
type ResponseList struct {
.....
Time *timestamp.Timestamp `protobuf:"bytes,3,opt,name=time,proto3" json:"time,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
partner.pg.go file (protoc 4.0.0 version created)
-----------------------------------------------
type ResponseList struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
.......
Time *timestamp.Timestamp `protobuf:"bytes,3,opt,name=time,proto3" json:"time,omitempty"`
}
-----------------------------------------------
utils.go file (time data is updated here to the structure)
func GenerateResponse(errorCode Error, mesg ...string) *pb.ResponseList {
time, _ := ptypes.TimestampProto(time.Now())
return &pb.ResponseList{
....
....
....
Time: time,
}
---------------------
Problem in the time format received, this affects our application which expects the data in 3.6.1 format
Timeformat received with 3.6.1 => "time": "2020-07-31T07:13:07.396733914Z",
Timeformat received with 4.0.0 => "time": {
"seconds": "1596871176",
"nanos": 363018229
},