From nobody Wed Feb 14 15:46:05 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 4TZjGg75l1z5BC03 for ; Wed, 14 Feb 2024 15:46:19 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (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 4TZjGg06tWz43nd for ; Wed, 14 Feb 2024 15:46:19 +0000 (UTC) (envelope-from mizhka@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=GCMgJOQ3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mizhka@gmail.com designates 2a00:1450:4864:20::536 as permitted sender) smtp.mailfrom=mizhka@gmail.com Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-55c2cf644f3so7543701a12.1 for ; Wed, 14 Feb 2024 07:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707925577; x=1708530377; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ZHN0iKxNdbgAl8vRmwSFkN4E9y/kZzqyR072SOfG7WY=; b=GCMgJOQ3nOqI7BG4y6Cwp/UoXR0GzszLBFQBR1cPcPwkaNxIiv3kGbG28A9HfQVr0N 7TjFG67hiOHxPzys5oELhYnfkgA0uDIjmrQ8EiA9ofiw32kZ8oG+GD7cvId64aVX52Qr +7KWt6ipkjnRCVpToZjEgyEBm1P/qPFSU9oz/qAzKr64nL8o9z5qdmAquHWlZ9AC0nhO gMBGVxLb66KVc2U+ndWl58Dc9y7hG+IhWeCKhpHghxYlZ/p23NF+djdI0Xwffb6Nwgzt IHD3fJOgBp10W6X/KOO3V5oTBek9wnz1u3hhY/T02NQ9uKPHV2P+vucMnZPfekVMC7WL 1uaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707925577; x=1708530377; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZHN0iKxNdbgAl8vRmwSFkN4E9y/kZzqyR072SOfG7WY=; b=ZK1VfGg75kRFWR2IzpwLMxQBi9t0EPEwb/cVGVtFK24Q9B9y2DLlbRbO+06u9Z9o++ q6q/SrxH7IoTIMEFhaqYBuKdBIqYjNjfNfNayQdeiiO1nSt9KfwqrylsaD31TfxM+s/R gB1eie9C4KCf6/kcBY8VQR97mGQknN1/IQiQ05gz0aXnmdRX/ZxVAkC9dVaGnJU8dHVx 54zvhr5ZGhs0V6WXhdw1pMEZRr22PtEEOjOUjbgVRqRGWsbbbWEHs4EGIJcL7YlYHncN vZUC/cPfz2QKAQJdoRg9PKaK0ruaYl2yRZ0cCTnFhuPBoVNTAeRcBSi63hbA0CnQVIj6 Cr/Q== X-Gm-Message-State: AOJu0Ywef/7rKPXk26cqHGsxsj01NS/Q/ZwI+wyc4w24Rxflcya2n6wn DbF7aNZXx4KoTqnXwt/uw5o8RtpV6Y1eGQWQlgKKpTqo6JSh3DB6z2qAP9WAR/ZTJGXXFZ7QWH5 6N8ZxB65u8dpvbvRiXgL+E0iUk5o= X-Google-Smtp-Source: AGHT+IGpQ9v46pNe1bLZ/ouE7BFHiWGw9rjIksGXz7JR4YDzZlIb4k6aC0zvf0JT1UdJgVCFwbB7tJKAReZcFPgMQ/U= X-Received: by 2002:aa7:dcc1:0:b0:55f:31f7:4279 with SMTP id w1-20020aa7dcc1000000b0055f31f74279mr2302043edu.12.1707925577331; Wed, 14 Feb 2024 07:46:17 -0800 (PST) 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 References: <004901da5c6b$a36b1150$ea4133f0$@gmail.com> In-Reply-To: <004901da5c6b$a36b1150$ea4133f0$@gmail.com> From: Michael Zhilin Date: Wed, 14 Feb 2024 18:46:05 +0300 Message-ID: Subject: Re: Issue: Java does not honor timezone setting To: csab6597@gmail.com Cc: freebsd-java@freebsd.org Content-Type: multipart/alternative; boundary="00000000000056fc140611596948" X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.88 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; NEURAL_HAM_LONG(-0.94)[-0.942]; NEURAL_HAM_SHORT(-0.94)[-0.942]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_TO(0.00)[gmail.com]; ARC_NA(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; DKIM_TRACE(0.00)[gmail.com:+]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; FREEMAIL_ENVFROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_NONE(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MISSING_XM_UA(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-java@freebsd.org]; MLMMJ_DEST(0.00)[freebsd-java@freebsd.org]; MID_RHS_MATCH_FROMTLD(0.00)[]; FREEFALL_USER(0.00)[mizhka]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::536:from] X-Rspamd-Queue-Id: 4TZjGg06tWz43nd --00000000000056fc140611596948 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, I've tried to use /usr/share/zoneinfo/CET as /etc/localtime and it seems java can't identify TZ correctly. But in case of particular country's TZ, it works fine: # tzsetup root@tamagawa /usr/share/zoneinfo # date Wed Feb 14 16:40:48 CET 2024 root@tamagawa /usr/share/zoneinfo # export JAVA_VERSION=3D17 root@tamagawa /usr/share/zoneinfo # jshell | Welcome to JShell -- Version 17.0.9 | For an introduction type: /help intro jshell> java.time.ZonedDateTime.now() $1 =3D=3D> 2024-02-14T16:41:13.106408203+01:00[Europe/Andorra] I have no access to TrueNAS & jdk19, could you please try to specify the country's TZ by tzsetup and check tz in java? Thanks! On Sun, Feb 11, 2024 at 12:53=E2=80=AFAM wrote: > 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 offs= et > 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 > --00000000000056fc140611596948 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I've tried to use /u= sr/share/zoneinfo/CET as /etc/localtime and it seems java can't identif= y TZ correctly.
But in case of particular country's TZ, it wo= rks fine:

=C2=A0# tzsetup
root@tamagawa /usr/sh= are/zoneinfo
=C2=A0# date
Wed Feb 14 16:40:48 CET 2024
root@tamaga= wa /usr/share/zoneinfo
=C2=A0# export JAVA_VERSION=3D17
root@tamagawa= /usr/share/zoneinfo
=C2=A0# jshell
| =C2=A0Welcome to JShell -- Vers= ion 17.0.9
| =C2=A0For an introduction type: /help intro

jshell&g= t; java.time.ZonedDateTime.now()
$1 =3D=3D> 2024-02-14T16:41:13.10640= 8203+01:00[Europe/Andorra]

I have no access to Tru= eNAS & jdk19, could you please try to specify the country's TZ by t= zsetup and check tz in java?

Thanks!


On Sun, Feb 11, 2024 at 12:53=E2=80=AFAM <csab6597@gmail.com> wrote:

Hi there,

=C2=A0=

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

<= span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0

# java -version

openjdk ve= rsion "19.0.2" 2023-01-17

<= p class=3D"MsoNormal" style=3D"background:rgb(232,232,232)">OpenJDK Runtime Environment (build 19.0.2+7-1)<= /u>

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

=C2=A0

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

When using the builtin command =C2=A0in the TrueNAS s= hell I can see

=C2=A0

# date
Sa=
t Feb 10 10:36:35 CET 2024=

= =C2=A0

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

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

= =C2=A0

# jshell
|=C2=A0 Welcome to JShell -- Version 19.0.2
|=C2=A0 For an introduction t=
ype: /help intro
=C2=A0
jshell> java.time.ZonedDateTime.now()
$3 =3D=3D> 2=
024-02-10T09:38:12.192401862Z[GMT]
=C2=A0
jshell> java.time.LocalDa=
teTime.now()
$1 =3D=3D> 2024-02-10T09:38:12.192401862Z=

=C2=A0

= =C2=A0

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

=C2=A0

Greets, Rainer <= /u>

--00000000000056fc140611596948--