Java time getting out of sync

Recently, I am experiencing a very strange error which I am unable to reproduce locally. It happens on a server (CentOS) inside a Spring Boot application.

calling new Date() (java.util.Date) produces wrong time. And I am not talking about an hour difference due to different timezone. The datetime is off by X minutes. It seems that it is gradually starting to lack behind the current time.

When getting the current system clock time, it seems to be correct but the Java time is gradually increasing the difference (not by one minute every minute but slower). Almost like the JVM existed in some time bubble with different laws of time.

This issue starting happening accidentally today after a long run without any problems.

Could someone suggest what should I try to debug this issue? I am clueless and cannot replicate this issue locally (everything works on local machine).

#java #spring-boot

5 Likes2.50 GEEK