You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/12/23 11:44:28 UTC

[GitHub] [servicecomb-pack] tnessn opened a new issue #620: 数据库时间不对

tnessn opened a new issue #620: 数据库时间不对
URL: https://github.com/apache/servicecomb-pack/issues/620
 
 
   ![image](https://user-images.githubusercontent.com/5991683/71356266-9d381880-25bc-11ea-8b99-7cd0d98e3775.png)
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-pack] tnessn commented on issue #620: 数据库时间不对

Posted by GitBox <gi...@apache.org>.
tnessn commented on issue #620: 数据库时间不对
URL: https://github.com/apache/servicecomb-pack/issues/620#issuecomment-568708024
 
 
   不知道代码里是不是传的时间戳,如果时间戳的话跟时区无关,应该不会有问题,跟使用Date和LocalDate是没多大关系的

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-pack] coolbeevip commented on issue #620: 数据库时间不对

Posted by GitBox <gi...@apache.org>.
coolbeevip commented on issue #620: 数据库时间不对
URL: https://github.com/apache/servicecomb-pack/issues/620#issuecomment-568705168
 
 
   抱歉,最近有点忙,关于时区问题我想有两个方案可以试试
   1. 在代码内使用 LocalDate 代替 Date,这样可以使用操作系统默认的时区(但是我不确定JPA是否会支持)
   2. 修改 postgresql.conf 中的 log_timezone 和 timezone ,改为 PRC

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-pack] coolbeevip commented on issue #620: 数据库时间不对

Posted by GitBox <gi...@apache.org>.
coolbeevip commented on issue #620: 数据库时间不对
URL: https://github.com/apache/servicecomb-pack/issues/620#issuecomment-568914325
 
 
   有点奇怪,我测试了以下,没有出现你说的问题,我是在mac下启动alpha和postgrs,没有发现你的问题
   
   我mac的时间和时区如下
   
   ```bash
   (base) bogon:mydocker zhanglei$ date -u
   2019年12月25日 星期三 16时16分31秒 UTC
   (base) bogon:mydocker zhanglei$ date -R
   Thu, 26 Dec 2019 00:17:24 +0800
   (base) bogon:mydocker zhanglei$ sudo systemsetup -gettimezone
   Password:
   Time Zone: Asia/Shanghai
   (base) bogon:mydocker zhanglei$
   ```
   但是我看到的 txevent表的createtime字段现实的是正确时区的时间
   
   这个字段的值是在alpha收到消息后 new Date() 初始化的,代码在https://github.com/apache/servicecomb-pack/blob/cdd571e030b8ca4ce4ca31fa8d233508c161ac46/alpha/alpha-server/src/main/java/org/apache/servicecomb/pack/alpha/server/GrpcTxEventEndpointImpl.java#L103
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-pack] tnessn commented on issue #620: 数据库时间不对

Posted by GitBox <gi...@apache.org>.
tnessn commented on issue #620: 数据库时间不对
URL: https://github.com/apache/servicecomb-pack/issues/620#issuecomment-568637464
 
 
   数据库时区
   ![image](https://user-images.githubusercontent.com/5991683/71391080-b503b100-263d-11ea-8a04-87b83e502047.png)
    

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-pack] tnessn commented on issue #620: 数据库时间不对

Posted by GitBox <gi...@apache.org>.
tnessn commented on issue #620: 数据库时间不对
URL: https://github.com/apache/servicecomb-pack/issues/620#issuecomment-569023684
 
 
   问题解决了 
   https://www.cnblogs.com/qdwyg2013/p/11275090.html

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-pack] WillemJiang commented on issue #620: 数据库时间不对

Posted by GitBox <gi...@apache.org>.
WillemJiang commented on issue #620: 数据库时间不对
URL: https://github.com/apache/servicecomb-pack/issues/620#issuecomment-568619942
 
 
   I checked the code of pack, it just create a new Date object when inserting the data.  You may need to setup your timezone for it.  You can find more information [here](https://stackoverflow.com/questions/2891361/how-to-set-time-zone-of-a-java-util-date).
   Not sure if we can setup the timezone for the DB. 
   @coolbeevip  Could you add some comment on this issue?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-pack] tnessn closed issue #620: 数据库时间不对

Posted by GitBox <gi...@apache.org>.
tnessn closed issue #620: 数据库时间不对
URL: https://github.com/apache/servicecomb-pack/issues/620
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services