liferoad commented on code in PR #30556:
URL: https://github.com/apache/beam/pull/30556#discussion_r1521671931


##########
sdks/python/apache_beam/utils/proto_utils.py:
##########
@@ -123,8 +126,25 @@ def pack_Struct(**kwargs):
 def from_micros(cls, micros):
   # type: (Type[TimeMessageT], int) -> TimeMessageT
   result = cls()
-  result.FromMicroseconds(micros)
-  return result
+  if isinstance(result, duration_pb2.Duration):
+    result.FromMicroseconds(micros)
+    return result
+  elif isinstance(result, timestamp_pb2.Timestamp):
+    result.seconds = micros // _MICROS_TO_SECONDS

Review Comment:
   can we add some comments here about why we do these conversions?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to