如何使用 adb 更改时区
我想使用 adb shell 命令更改时区。
我浏览了一些允许在 Linux 中更改它的帖子,但它们对 Android 无效。
I want to change the timezone using adb shell command.
I went through some posts which allow changing it in linux, but they are not valid for android.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我更改了 2 个文件来更改我的时区。
我不完全知道是否有必要,但它使事情保持同步:
您肯定需要更改的内容:
来自 http://www.cyberciti.biz/faq/linux-unix-set-tz-environment-variable/ 即可确定名称您想要的时区
tzselect
。我从 http://www. cyberciti.biz/faq/howto-set-date-and-time-timezone-in-freebsd/
并将我的时区文件从
/usr/share/zoneinfo/
复制到/etc/localtime
。/etc/timezone
是一个带有时区名称的文本文件。所以我只是更新了它以匹配 tzselect 提供的值。I changed 2 files to change my timezone.
the one that i don't entire know if it's necessary, but it keeps things in sync:
the more one you for sure need to change:
from http://www.cyberciti.biz/faq/linux-unix-set-tz-environment-variable/ you can determine the name of the timezone you want with
tzselect
.I took inspiration from http://www.cyberciti.biz/faq/howto-set-date-and-time-timezone-in-freebsd/
and copied my timezone file from
/usr/share/zoneinfo/
to/etc/localtime
./etc/timezone
is a text file with the name of the timezone. so i just updated it to match the value provided bytzselect
.请参阅此 https://gist.github.com/jpkrause/6b7e576894a800d451bf 来回答您的问题问题。
所以在你的情况下它将是:
adb shell setprop persist.sys.timezone 美国/芝加哥
Please see this https://gist.github.com/jpkrause/6b7e576894a800d451bf for answer to your question.
So in your case it would be:
adb shell setprop persist.sys.timezone America/Chicago
这适用于 ADB
获取当前全球时区:
设置时区:
时区列表:
https://en。 wikipedia.org/wiki/List_of_tz_database_time_zones
This works with ADB
Get current global time zone:
Set a time zone:
Time zones list:
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
以我(非常)有限的经验,我已经能够编辑 /system/build.prop 文件。我将其中的 persist.sys.timezone=America/Sao_Pao 或类似驱动器的行更改为 persist.sys.timezone=America/Chicago 作为我的时区 CDT。我还分别将 persist.sys.language=bt 和 persist.sys.country=AR 行更改为 persist.sys.language=en 和 persist.sys.country=US 。
您还可以在该文件中调整一些其他内容,这些内容在系统还原后仍将保留。您可能需要确保 Flash 映像或目录中的 build.prop 文件包含正确的行。
/system/property 目录似乎包含多个具有单个值的文本文件。这些似乎在使用 setprop 之后出现,但操作系统似乎没有反映这些更改。
编辑这些文件通常需要使用术语程序或 ADB.exe shell 进行 root 访问。 (ADB = Android SDK 中提供的 Android Device Bridge)我在 JXD.HK 上查找 S18 MiniiPad 的固件下载时发现了 ADB.exe。在 files.rar dl 中,还有 SuperUser.apk 以及 busybox 和 su 的 root 版本。
祝你好运!
In my (very) limited experience I have been able to edit the /system/build.prop file. I change the line in there that says persist.sys.timezone=America/Sao_Pao or some such drival to persist.sys.timezone=America/Chicago for my timezone CDT. I also changed the lines persist.sys.language=bt and persist.sys.country=AR to persist.sys.language=en and persist.sys.country=US respectively.
There are a few other things you can tweak in the file that will persist after a system restore. You might want to make sure that the build.prop file in a flash image or directory has the correct lines in it.
The /system/property directory seems to hold several text files with a single value. These seem to show up after using setprop but the OS doesn't seem to reflect the changes.
Editing these files usually does require root access either with a term program or the ADB.exe shell. (ADB = Android Device Bridge available in the Android SDK) I found ADB.exe while looking through the firmware downloads at JXD.HK for the S18 MiniPad. In the files.rar dl there is also the SuperUser.apk and a rooted version of busybox and su.
Best of Luck !!!
4 - 代表报警服务实现中的第四个功能。
s16 - 代表字符串参数类型。
https://android.stackexchange.com/ questions/34625/在哪里可以找到所有系统bin服务调用的描述
4 - stands for the fourth function in alarm service implementation.
s16 - stands for string argument type.
https://android.stackexchange.com/questions/34625/where-to-find-description-of-all-system-bin-service-calls
对于 tzdata 值列表,我访问 http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
要设置时区,请使用 setprop persist.sys.timezone命令:
For the list of tzdata values I go to http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
To set the timezone use
setprop persist.sys.timezone <TZ>
command:adb shell service call Alarm 3 s16 America/Phoenix
,立即生效。setprop
和persist.sys.timezone
仅在重新启动后才有效。adb shell service call alarm 3 s16 America/Phoenix
, which will be effective immediately.setprop
withpersist.sys.timezone
only works after reboot.