Обновление временных зон на Android / Хабр

Check java timezone

Before we update java timezone, we should check the existing tzdata bundle which is part of our OpenJDK rpm. Use the below syntax:

# cd /root/tzupdater-2.2.0/

# java -jar tzupdater.jar -V | grep version
tzupdater version 2.2.0-b01
JRE tzdata version: tzdata2022i
tzupdater tool would update with tzdata version: tzdata2022b

So currently my OpenJDK contains tzdata2022i which is really very old considering the latest available tzdata at the time of writing this article is 2022b.

Download tzdata archive

To update or set java timezone we must next manually download the tzdata archive. But if you just wish to use the latest available tzdata archive at IANA to update tzdata for OpenJDK then you need not download any archive. You just need an active internet connection and tzupdater tool will download the latest tzdata archive and install it in your openJDK binary.

To download different version of tzdata, you can check IANA page.

How to fix failed while parsing file ‘/tmp/tz.tmp/asia’?

This has to be fixed by the development team of tzdata but for us to proceed we can use a workaround as also worked for me. I checked some backlogs and history and turns out all the tzdata released after 2022d contains this problem for asia timezone file. So we can take the asia timezone file from tzdata 2022d and replace it in tzdata2022b

Download tzdata2022d from iana pageExtract it under a temporary location

# mkdir /tmp/tzdata2022d

# cp tzddata2022d.tar.gz /tmp/tzdata2022d

# cd /tmp/tzdata2022d

# tar -xzvf tzddata2022d.tar.gz

Для tzdata2022b действия такие же.

# mkdir /tmp/tzdata2022b

# cp tzddata2022b.tar.gz /tmp/tzdata2022d

# cd /tmp/tzdata2022b

# tar -xzvf tzddata2022b.tar.gz

Next replace the asia timezone from from 2022d to 2022b

node1:/tmp/tzdata2022d # cp asia ../tzdata2022b/asia

node1:/tmp/tzdata2022d # cd ../tzdata2022b/

Next re-create the archive for 2022b with the latest changes

node1:/tmp/tzdata2022b # tar -czvf ../tzdata2022b.tar.gz *

Now let us re-try to set java timezone using tzupdater tool

node1:/tmp/tzupdater-2.2.0 # java -jar tzupdater.jar -l file:///tmp/tzdata2022b.tar.gz

So our workaround worked and we are have successfully set java timezone.Using file:///tmp/tzdata2022b.tar.gz as source for tzdata bundle.

node1:/tmp/tzupdater-2.2.0 # java -jar tzupdater.jar -V
tzupdater version 2.2.0-b01
JRE tzdata version: tzdata2022b
tzupdater tool would update with tzdata version: tzdata2022b

Restart your java applications to activate the new timezone related changes

:/>  Можно ли удалить Android System Webview в телефоне?

Install tzupdater

Once you have downloaded the tzupdater archive, you can extract it under any location on your Linux host using the steps as shown below:

# unzip tzupdater-2_2_0.zip
Archive:  tzupdater-2_2_0.zip
   creating: tzupdater-2.2.0/
  inflating: tzupdater-2.2.0/README
  inflating: tzupdater-2.2.0/tzupdater.jar

Method 1: update tzdata for openjdk using tzupdater

The first method to update tzdata for openJDK is usign TZUpdater tool. TZUpdater is a third party tool from Oracle which can be downloaded from official Oracle page.

Method 2: update tzdata for openjdk using tzdata-java

For OracleJDK in Red Hat/CentOS environment you can alternatively use tzdata-java rpm which will also internally set java timezone without any hassle.

Currently my system is running with 2022e version of tzdata rpm as you can see below:

# rpm -qa | grep tzdata
tzdata-java-2022e-3.el7.noarch
tzdata-2022e-3.el7.noarch

Also if we check java version using tzupdater, my OpenJDK has 2022e version of tzdata

[root@node1 tzupdater-2.2.0]# java -jar tzupdater.jar -V
tzupdater version 2.2.0-b01
JRE tzdata version: tzdata2022e
tzupdater tool would update with tzdata version: tzdata2022b

Next we will update tzdata rpm to 2022a by manually downloading the rpm from IANA database

[root@node1 tzupdater-2.2.0]# rpm -Uvh /root/tzdata-2022a-1.el7.noarch.rpm
warning: /root/tzdata-2022a-1.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:tzdata-2022a-1.el7               ################################# [ 50%]
Cleaning up / removing...
   2:tzdata-2022e-3.el7               ################################# [100%]

And re-verify the tzdata version for OpenJDK, which remains unchanged to we know tzdata has no impact on tzdata of OracleJDk

[root@node1 tzupdater-2.2.0]# java -jar tzupdater.jar -V
tzupdater version 2.2.0-b01
JRE tzdata version: tzdata2022e
tzupdater tool would update with tzdata version: tzdata2022b

После этого rpm tzdata-java будет обновлен до 2022a.

[root@node1 tzupdater-2.2.0]# rpm -Uvh /root/tzdata-java-2022a-1.el7.noarch.rpm
warning: /root/tzdata-java-2022a-1.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:tzdata-java-2022a-1.el7          ################################# [ 50%]
Cleaning up / removing...
   2:tzdata-java-2022e-3.el7          ################################# [100%]

Re-verify the tzdata for OracleJDK, as you see now our java for OpenJDK also contains tzdata2022a

[root@node1 tzupdater-2.2.0]# java -jar tzupdater.jar -V
tzupdater version 2.2.0-b01
JRE tzdata version: tzdata2022a
tzupdater tool would update with tzdata version: tzdata2022b

Restart your java applications to activate the new timezone related changes

:/>  Глава 2. Примеры использования  стандартных объектов WSH (JScript и VBScript). «Windows Script Host для Windows 2000/XP» | Попов Андрей Владимирович

Lastly I hope the steps from the article to update or set java timezone (update tzdata for openJDK) using tzupdater on Linux was helpful. So, let me know your suggestions and feedback using the comment section.

Set java timezone using tzupdater

Now since my system is connected to internet and I wish to apply the latest available tzdata, I will just execute the below command to update or set java timezone:

What is tzupdater?

The TimeZone updater tool or TZUpdater tool is provided to allow you to update installed Java Development Kit (JDK) and Java Runtime Environment (JRE) software with more recent timezone data, to accommodate daylight saving time (DST) changes in different countries. Oracle relies on the timezone data publicly available through IANA’s Time Zone Database.

In RHEL or CentOS environment you will find tzdata rpm which controls the timezone applied at system level while tzdata-java controls the timezone for java oriented applications such as openJDK, JRE etc

But still for the sake of this article I will share the steps which can be used to set java timezone in RHEL/CentOS/SLES or distributions having similar source code.

Инструменты

Кратко, потому что «растекания мысью по древу» вряд ли будут кому-то интересны.


В итоге всё оказалось намного проще. После получаса настойчивых поисков была

, по которой лежал набор development tools для android, в том числе — шелл-скрипт, вызвающий zic для определенного набора каталогов и генерирующий выходные данные, и исходник на Java для, собственно, создания zoneinfo.dat и zoneinfo.idx.

Файл, содержащий данные для часового пояса, к которому должен быть применен сценарий, найден.

:/>  Как настроить права на доступ пользователей к реестру в Windows

Обновление через adb


Предполагаю, что с базовыми знаниями о adb: что это такое, как им пользоваться, где брать — вы знакомы. Если нет — то

первая найденная с ходу ссылка, изучаем…

Обновление через custom recovery на примере cwm-alpharev recovery

Описание относится к HTC Desire A8181; на телефонах других моделей процесс входа в recovery может слегка отличаться.

Противоречивая информация

По информации, найденной в Сети, файл временных зон в Android находится:


Взяв в руки adb, far и прочие нужные вещи, принялся за мини-исследование. Итог:

Результаты

В итоге — получаем актуальные файлы временных зон для Android, осталось залить их в устройство. Увы, пользователям без root-доступа к телефону обновление не грозит.

Существует два варианта обновления.

Оставьте комментарий

Adblock
detector