quarkus: Native image does not inherit system time zone
Native image does ignore system time zone, assumes GMT instead. Code snippet to verify:
@ApplicationScoped
public class Startup {
public void startup(@Observes StartupEvent ev) {
System.out.println("--- default time zone id is: " + ZoneId.systemDefault());
}
}
Output (no matter system timezone is):
--- default time zone id is: GMT
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 29 (19 by maintainers)
I’m looking at the source code and it looks like this:
So it looks to me like it’s only including, by default, GMT, UTC, and whatever the build host’s time zone is. So if the run host has a different time zone, you won’t get it and it’ll fall back to UTC. This should be verifiable by building a native image with a different value set for the
TZenv. variable and then running it to see if it falls back to UTC.Setting
-H:+IncludeAllTimeZonesshould “fix” the problem but might inflate the image significantly.Stupid question but would the timezone be fixed at build time?
On Thu, Oct 31, 2019 at 4:09 PM sgerr notifications@github.com wrote:
I’ve raised a graal PR https://github.com/oracle/graal/pull/1819 to see if we can have timezone support enhanced to allow more fine grained control on how users or Quarkus can configure the available timezones in native-image.