From nobody Sat Feb 10 21:53:52 2024 X-Original-To: freebsd-java@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TXPcg19NCz5BRM7 for ; Sat, 10 Feb 2024 21:53:55 +0000 (UTC) (envelope-from csab6597@gmail.com) Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TXPcf1yz6z4dJX for ; Sat, 10 Feb 2024 21:53:54 +0000 (UTC) (envelope-from csab6597@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=I2su9lvL; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of csab6597@gmail.com designates 2a00:1450:4864:20::12e as permitted sender) smtp.mailfrom=csab6597@gmail.com Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5116ec49081so2277554e87.2 for ; Sat, 10 Feb 2024 13:53:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707602031; x=1708206831; darn=freebsd.org; h=content-language:thread-index:mime-version:message-id:date:subject :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Gh5imM7HtECpFwPDyXcLS5ytjUAor6servgHTSX3P+c=; b=I2su9lvLIIbuzlXgMZKkiHDqUnBm6r2KHhVyg/IO8p5GR1Pt291/fWchh7HarajH6+ i634P/cPwm3mRG+gPpmjcK6cXBqfxqhoY9roYVXCxBolGnVgZubofGpEJoJcH5AiqcnX Zxqdx/cSca6Oh+imW5XTOmwR6yqqEvwdGilDP2IDqTLwLKZIPj54PliSFvORZ7fi2ZCz wVeeGUiBS58MTtYTuMOlHjNV11VJ6x0pQgDkGSeK0CduHIfflWDefRAmDeCT3SOLgAWz Fa4JkEKSVXc3Qi6NjdbN4kO/rLSs2V8p+gVHoo5zccmmWjNFR7a+0oGRC2T7bRGT3XaT RHdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707602031; x=1708206831; h=content-language:thread-index:mime-version:message-id:date:subject :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Gh5imM7HtECpFwPDyXcLS5ytjUAor6servgHTSX3P+c=; b=rI3LwKIcYnPIq/oG7+8zGRC/YHVRZyIJBl2Vf1qhaswK5biSDwv3lj6XAtKG3qbE0S gPkgrPhcII5zBUSwYE7mvExvVtr+PYlOk0wz3QKvJnLHQJhgG1W6c4IcoifJ+qg2e8Vv N8eBdlNfzZx/iDs+WMJWrBUnx1gIgnZ7yo2qizyii9vqJqX8Iiqr0XPVOxVGSrlmx7XJ pnHPVMLfyHxbRsCX10jqwvVImihWAf4PHm11QYU/4PhG+yLL02t4bF8eyOak/quVBMRJ 58MQ2I8yfnEvZwCHf4TK/VpaqaBDNqogNnA243uIX0ai2BJAzD9XuOpWDQICMupAvzIe JUAg== X-Gm-Message-State: AOJu0YwgdQ68BBg8+OfgmGpTKgU9/D5DR5XktOQlBklczSWL1oxXrh8N 66osNhi7sgwGeKCB75ClnoX/DT+C55f8xpTbUeHSNNbZ4OEPMdJxrFQGl8Yx X-Google-Smtp-Source: AGHT+IEfGmE/jZYFtF1ic7WX95xJN0eduklAD7cw2QerhDOyJXfAD3rxiNOpoJ3FiFfsUhpQzKq23w== X-Received: by 2002:ac2:4d06:0:b0:511:52fb:cb1e with SMTP id r6-20020ac24d06000000b0051152fbcb1emr1893066lfi.36.1707602031266; Sat, 10 Feb 2024 13:53:51 -0800 (PST) Received: from RAY ([2001:871:24b:d5c7:34bf:28f4:bc2f:57a6]) by smtp.gmail.com with ESMTPSA id z10-20020a17090655ca00b00a38620c3b3dsm2182767ejp.198.2024.02.10.13.53.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Feb 2024 13:53:50 -0800 (PST) From: To: Subject: Issue: Java does not honor timezone setting Date: Sat, 10 Feb 2024 22:53:52 +0100 Message-ID: <004901da5c6b$a36b1150$ea4133f0$@gmail.com> List-Id: Porting Java to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-java List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-java@freebsd.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_004A_01DA5C74.0530B1D0" X-Mailer: Microsoft Outlook 16.0 Thread-Index: Adpca1FYi60/Srk9SQmUyhfih0u5JA== Content-Language: de-at X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.988]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCPT_COUNT_ONE(0.00)[1]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_FROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_COUNT_TWO(0.00)[2]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; PREVIOUSLY_DELIVERED(0.00)[freebsd-java@freebsd.org]; TO_DN_NONE(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_NO_DN(0.00)[]; MLMMJ_DEST(0.00)[freebsd-java@freebsd.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::12e:from] X-Rspamd-Queue-Id: 4TXPcf1yz6z4dJX This is a multipart message in MIME format. ------=_NextPart_000_004A_01DA5C74.0530B1D0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi there, I am using TrueNAS Core TrueNAS-13.0-U6.1 where in a jail I installed jdk 19. In the shell I get # java -version openjdk version "19.0.2" 2023-01-17 OpenJDK Runtime Environment (build 19.0.2+7-1) OpenJDK 64-Bit Server VM (build 19.0.2+7-1, mixed mode, sharing) The issue I encountered is that java does not honor the timezone I have set in TrueNAS. When using the builtin command in the TrueNAS shell I can see # date Sat Feb 10 10:36:35 CET 2024 So that command reports CET timezone which is in fact what it should be, what is set in TrueNAS system configuration But inside java, for a test just using jshell, then java will report GMT which means java is ignoring the timezone setting and thus giving an offset to the actual time # jshell | Welcome to JShell -- Version 19.0.2 | For an introduction type: /help intro jshell> java.time.ZonedDateTime.now() $3 ==> 2024-02-10T09:38:12.192401862Z[GMT] jshell> java.time.LocalDateTime.now() $1 ==> 2024-02-10T09:38:12.192401862Z Also tested in Windows and Ubuntu where Java will indeed report the correct timezone Greets, Rainer ------=_NextPart_000_004A_01DA5C74.0530B1D0 Content-Type: text/html; boundary="----=_NextPart_000_002C_01DA5C72.F2D34490"; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi there,

 

I am = using TrueNAS Core TrueNAS-13.0-U6.1 where in a jail I installed jdk 19. = In the shell I get

 

# java -version

openjdk version "19.0.2" = 2023-01-17

OpenJDK Runtime Environment (build = 19.0.2+7-1)

OpenJDK 64-Bit Server VM (build = 19.0.2+7-1, mixed mode, sharing)

 

The = issue I encountered is that java does not honor the timezone I have set = in TrueNAS.

When using the builtin command  in the = TrueNAS shell I can see

 

# =
date
Sat Feb 10 10:36:35 CET 2024

 

So that = command reports CET timezone which is in fact what it should be, what is = set in TrueNAS system configuration

But = inside java, for a test just using jshell, then java will report GMT = which means java is ignoring the timezone setting and thus giving an = offset to the actual time

 

# =
jshell
|  Welcome to JShell -- Version =
19.0.2
|  For an introduction type: /help =
intro
 
jshell> =
java.time.ZonedDateTime.now()
$3 =
=3D=3D> 2024-02-10T09:38:12.192401862Z[GMT]
 
jshell> =
java.time.LocalDateTime.now()
$1 =
=3D=3D> 2024-02-10T09:38:12.192401862Z

 

 

Also = tested in Windows and Ubuntu where Java will indeed report the correct = timezone

 

Greets, = Rainer

------=_NextPart_000_004A_01DA5C74.0530B1D0--