tikafu opened a new issue, #21891:
URL: https://github.com/apache/pulsar/issues/21891

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Version
   
   Nothing with. OS and Pulsar version.
   
   ### Minimal reproduce step
   
   1. The broker and the admin client use different timezone while the producer 
and the admin client use the same timezone;
   2. Produce one message to pulsar and keep the message id;
   3. Invoke PulsarAdmin.topics().getMessageById().getPublishTime() to get the 
publish time of corresponding message, you may find that it is different with 
the origin publish time created by producer.
   
   ### What did you expect to see?
   
   Get correct publish time through admin client though timezones between 
client and broker are different.
   
   ### What did you see instead?
   
   - There is a  time format operation in 
org.apache.pulsar.broker.admin.impl.PersistentTopicsBase.java
   
   ```
   ...
   if (metadata.hasPublishTime()) {
       responseBuilder.header("X-Pulsar-publish-time", 
DateFormatter.format(metadata.getPublishTime()));
   }
   ...
   ```
   
   - There is also a time format operation in 
org.apache.pulsar.client.admin.internal.TopicsImpl.java
   
   ```
   ...
   Object tmp = headers.getFirst(PUBLISH_TIME);
   if (tmp != null) {
       messageMetadata.setPublishTime(DateFormatter.parse(tmp.toString()));
   }
   ...
   ```
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


-- 
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