@@ -270,6 +270,11 @@ static void SerializeTimestamp(
270270 (*root) = Json::Value (value);
271271}
272272
273+ static void SerializeTimestampUnixMsec (const TimestampModel& model,
274+ Json::Value* root) {
275+ int64_t total_millis = model.seconds * 1000 + model.nanos / (1000 * 1000 );
276+ (*root) = Json::Value (total_millis);
277+ }
273278
274279static void SerializeModel (
275280 const StatusMessageModel& model,
@@ -374,6 +379,23 @@ TimestampModel DeserializeTimestamp(const Json::Value& root) {
374379 return timestamp;
375380}
376381
382+ TimestampModel DeserializeTimestampUnixMsec (const Json::Value& root) {
383+ if (!root.isInt64 ()) {
384+ return kUnspecifiedTimestamp ;
385+ }
386+
387+ int64_t total_millis = root.asInt64 ();
388+
389+ if (total_millis == 0 ) {
390+ return kUnspecifiedTimestamp ;
391+ }
392+
393+ TimestampModel timestamp;
394+ timestamp.seconds = total_millis / 1000 ;
395+ timestamp.nanos = (total_millis % 1000 ) * 1000 * 1000 ;
396+
397+ return timestamp;
398+ }
377399
378400template <>
379401std::unique_ptr<StatusMessageModel> DeserializeModel<StatusMessageModel>(
@@ -558,6 +580,11 @@ static void SerializeModel(
558580 SerializeTimestamp (model.create_time , &(*root)[" createTime" ]);
559581 }
560582
583+ if (model.create_time_unix_msec != kUnspecifiedTimestamp ) {
584+ SerializeTimestampUnixMsec (model.create_time_unix_msec ,
585+ &(*root)[" createTimeUnixMsec" ]);
586+ }
587+
561588 if (model.status != nullptr ) {
562589 SerializeModel (*model.status , &(*root)[" status" ]);
563590 }
@@ -611,9 +638,16 @@ std::unique_ptr<BreakpointModel> DeserializeModel<BreakpointModel>(
611638 // Final state flag.
612639 model->is_final_state = JsonCppGetBool (root, " isFinalState" , false );
613640
614- // Breakpoint creation time.
641+ // Breakpoint creation time. This field is from the Cloud Debugger GCP Backend
642+ // version of the service, and is a string in RFC3339 format.
615643 model->create_time = DeserializeTimestamp (root[" createTime" ]);
616644
645+ // Breakpoint creation time. This field is from the OSS Snapshot Debugger
646+ // Firebase Backend version of the service, and is an integer representing
647+ // unix epoch time in milliseconds.
648+ model->create_time_unix_msec =
649+ DeserializeTimestampUnixMsec (root[" createTimeUnixMsec" ]);
650+
617651 // Breakpoint status.
618652 if (root.isMember (" status" )) {
619653 model->status = DeserializeModel<StatusMessageModel>(root[" status" ]);
0 commit comments