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)*
-----------------------------------------------
timestamp "github.com/golang/protobuf/ptypes/timestamp"
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)*
-----------------------------------------------
timestamp "github.com/golang/protobuf/ptypes/timestamp"
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)*
import pb "github.com/xxxxx/proto/partner"
import "github.com/golang/protobuf/ptypes"
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 },*
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/protobuf/3a10f37f-0fee-48c8-bced-05d45af4a5b9o%40googlegroups.com.