Android JB version How to update time zone data file

Source: Internet
Author: User
Tags gz file

In the Android JB version, the System/usr/share/zoneinfo directory Zoneinfo related 3 files are data files that are used to store time zone information for each country and region city. Since the time zone information in each country will change, for example, June 13, 2014, Russia announced that the national time zone after October 26, 2014 after one hour, such as Moscow before is gmt+4, modified is gmt+3, but the file in Android will not automatically update, Therefore, the time zone information of the phone will be displayed incorrectly during the test. In this case, you need to update your phone's time zone information file.

1. To the website ftp://ftp.iana.org/tz/releases/download time zone tzdata*.tar.gz file, because the JB version uses the data and now KK's different, to download the 2013-year version
such as tzdata2013a.tar.gz
2. Unzip and modify tzdata2013a.tar.gz related time zone files, packaging again for tzdata2013a.tar.gz, how to modify can refer to FAQ04310 how to modify the time zone data file
3. Copy the modified tzdata2013a.tar.gz to the path \bionic\libc\tools\zoneinfo
4. Modify the Generate script file and replace it with the following:
\bionic\libc\tools\zoneinfo\generate File Contents:
#!/bin/bash
# Run with no arguments from any directory, with no special setup required.
# Abort If any command returns a error exit status, or if an undefined
# variable is used.
Set-e
Set-u
echo "Looking for bionic ..."
bionic_dir=$ (CD $ (dirname $)/. /.. /.. && pwd)
bionic_zoneinfo_dir= $bionic _dir/libc/zoneinfo
bionic_zoneinfo_tools_dir= $bionic _dir/libc/tools/zoneinfo
if [[!-D "$bionic _zoneinfo_dir"
|| ! -D "$bionic _zoneinfo_tools_dir"];
Then
echo "Can ' t find Bionic ' s zoneinfo directories!"
Exit 1
Fi
echo "Switching to temporary directory ..."
Temp_dir= ' mktemp-d '
CD $temp _dir
Trap "RM-RF $temp _dir; Exit "INT term exit
# URL from ' Sources for time Zone and daylight saving time Data '
# http://www.twinsun.com/tz/tz-link.htm
echo "Looking for new tzdata ..."
#wget-N--no-verbose ' ftp://munnari.oz.au/pub/tzdata*.tar.gz '
CP $bionic _zoneinfo_tools_dir/tzdata*.tar.gz $temp _dir/
zoneinfo_version_file= $bionic _zoneinfo_dir/zoneinfo.version
If [-F "$zoneinfo _version_file"]; Then
Current_version=tzdata ' sed s/\n//< $zoneinfo _version_file '
Else
Current_version=missing
Fi
Latest_archive= ' Ls-r-v tzdata*.tar.gz | Head-n1 '
Latest_version= ' basename $latest _archive. tar.gz '
If ["$current _version" = = "$latest _version"]; Then
echo "You already has the latest tzdata ($latest _version)!"
Exit 1
Fi
Md5_sum= ' md5sum $latest _archive '
echo "MD5: $md 5_sum"
echo "Extracting $latest _version ..."
mkdir $latest _version
Tar-c $latest _version-zxf $latest _archive
echo "Compiling $latest _version ..."
mkdir data
For i in \
Africa \
Antarctica \
Asia \
Australasia \
Etcetera \
Europe \
Factory \
NorthAmerica \
SOLAR87 \
solar88 \
SOLAR89 \
Southamerica
Do
zic-d Data $latest _version/$i
Done
echo "Compacting $latest _version ..."
(
Cat $latest _version/* | grep ' ^link ' | awk ' {print $, $, $ $} '
(
Cat $latest _version/* | grep ' ^zone ' | awk ' {print $} '
Cat $latest _version/* | grep ' ^link ' | awk ' {print $} '
) | Lc_all= "C" sort
) | Grep-v RIYADH8 > Setup
Javac-d. \
$bionic _zoneinfo_tools_dir/zonecompactor.java \
$bionic _zoneinfo_tools_dir/zoneinfo.java
Java zonecompactor setup Data
echo "Updating bionic to $latest _version ..."
MV Zoneinfo.dat Zoneinfo.idx $bionic _zoneinfo_dir
echo $latest _version | Sed ' s/tzdata//' > $bionic _zoneinfo_dir/zoneinfo.version
5. Execute the modified generate script (./generate) and execute the command line information after successful execution
6. After successful execution of the script, Zoneinfo.dat Zoneinfo.idx and zoneinfo.version three files will be updated under Path Bionic/libc/zoneinfo to see the modified time of these three files, which should be the latest time.
7. Push the three files to the phone system/usr/share/zoneinfo to test or rebuild the entire project.

Android JB version How to update time zone data file

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.