6.0 rc2 defaults to treat hardware clock as local time?

467 views
Skip to first unread message

James Chai

unread,
Aug 22, 2016, 10:19:32 AM8/22/16
to Android-x86
I'm tri-booting Windows, Archlinux and Android on my Surface. Archlinux defaults to UTC hardware clock and I've configured windows to treat hardware clock as UTC as well. However Android 6.0 rc2 seems to use hardware clock as local time, which cause problems on time-based protocols.

Is there a hack or configuration file to toggle hardware clock as UTC?

Chih-Wei Huang

unread,
Aug 22, 2016, 10:32:39 AM8/22/16
to Android-x86
2016-08-22 15:11 GMT+08:00 James Chai <cth...@gmail.com>:
> I'm tri-booting Windows, Archlinux and Android on my Surface. Archlinux
> defaults to UTC hardware clock and I've configured windows to treat hardware
> clock as UTC as well. However Android 6.0 rc2 seems to use hardware clock as
> local time, which cause problems on time-based protocols.

Windows treats RTC as local time by default.
So we do the "improvement" as well.
Before that people usually complain about it.

> Is there a hack or configuration file to toggle hardware clock as UTC?

Set persist.rtc_local_time=0



--
Chih-Wei
Android-x86 project
http://www.android-x86.org

James Chai

unread,
Sep 19, 2016, 10:02:24 PM9/19/16
to Android-x86
Setting this in /default.prop doesnot change this behavior, is this defined else where?
Message has been deleted

Chih-Wei Huang

unread,
Sep 20, 2016, 12:35:43 AM9/20/16
to Android-x86
2016-09-20 10:02 GMT+08:00 James Chai <cth...@gmail.com>:
> Setting this in /default.prop doesnot change this behavior, is this defined
> else where?

Did you change the default.prop in the ramdisk.img?
If so, post your full default.prop for diagnosis.

James Chai

unread,
Sep 20, 2016, 12:50:05 AM9/20/16
to andro...@googlegroups.com
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=1
security.perf_harden=1
ro.allow.mock.location=0
ro.debuggable=1
ro.zygote=zygote64_32
ro.arch=x86
persist.rtc_local_time=0
ro.dalvik.vm.native.bridge=libnb.so
dalvik.vm.image-dex2oat-Xms=64m
dalvik.vm.image-dex2oat-Xmx=64m
dalvik.vm.dex2oat-Xms=64m
dalvik.vm.dex2oat-Xmx=512m
debug.atrace.tags.enableflags=0
#
# BOOTIMAGE_BUILD_PROPERTIES
#
ro.bootimage.build.date=Mon Sep 19 20:18:10 CDT 2016
ro.bootimage.build.date.utc=1474334290
ro.bootimage.build.fingerprint=Android-x86/android_x86_64/x86_64:6.0.1/MOB31E/cth45109192018:userdebug/test-keys
persist.sys.usb.config=adb
--
Best Regards, Tianhao Chai aka. cth451
signature.asc

Chih-Wei Huang

unread,
Sep 20, 2016, 1:18:31 AM9/20/16
to Android-x86
2016-09-20 12:49 GMT+08:00 James Chai <cth...@gmail.com>:
> #
> # ADDITIONAL_DEFAULT_PROPERTIES
> #
> ro.secure=1
> security.perf_harden=1
> ro.allow.mock.location=0
> ro.debuggable=1
> ro.zygote=zygote64_32
> ro.arch=x86
> persist.rtc_local_time=0
> ro.dalvik.vm.native.bridge=libnb.so
> dalvik.vm.image-dex2oat-Xms=64m
> dalvik.vm.image-dex2oat-Xmx=64m
> dalvik.vm.dex2oat-Xms=64m
> dalvik.vm.dex2oat-Xmx=512m
> debug.atrace.tags.enableflags=0
> #
> # BOOTIMAGE_BUILD_PROPERTIES
> #
> ro.bootimage.build.date=Mon Sep 19 20:18:10 CDT 2016
> ro.bootimage.build.date.utc=1474334290
> ro.bootimage.build.fingerprint=Android-x86/android_x86_64/x86_64:6.0.1/MOB31E/cth45109192018:userdebug/test-keys
> persist.sys.usb.config=adb

Looks good.
But what's getprop persist.rtc_local_time exactly?
Note this is a persist property which
means its value will be kept unless
you do factory reset or set it again explicitly.

James Chai

unread,
Sep 20, 2016, 10:48:44 AM9/20/16
to andro...@googlegroups.com

it gives 0

signature.asc

James Chai

unread,
Oct 4, 2016, 6:17:24 PM10/4/16
to Android-x86
bump, so there's no fix?

There are a few points.
1. Normally, you would treat hardware clock to utc and display as another time zone (Which is Chicago, in my case).
2. When user updates time zone settings, hardware clock shouldn't be changed.
3. When user does change time manually, hardware clock should be set to the corresponding utc time.

However with persist.rtc_local_time=0 on Android 6.0 rc2+, system still treats hardware clock as local time but no longer updates the hardware clock correspondingly even if I change the time manually

dgdn

unread,
Oct 4, 2016, 7:56:09 PM10/4/16
to Android-x86
well, I had fixed the issue long ago with my dual-boot with windows as there is a "standard fix" for the reg in windows
and it was working for me very well.....UNTIL this improvement was introduced and now it's broken for me also....

so I just ignore it now....not a big deal, just need to get everyone on the same page...ie MS / Google / etc.

every time any of them change something to make it better...it all breaks again...

I think I documented it all at android-x86.net at one point....

Chih-Wei Huang

unread,
Oct 4, 2016, 11:14:09 PM10/4/16
to Android-x86
2016年10月5日 上午6:17,"James Chai" <cth...@gmail.com>寫道:
>
> bump, so there's no fix?
>
> There are a few points.
> 1. Normally, you would treat hardware clock to utc and display as another time zone (Which is Chicago, in my case).
> 2. When user updates time zone settings, hardware clock shouldn't be changed.
> 3. When user does change time manually, hardware clock should be set to the corresponding utc time.
>
> However with persist.rtc_local_time=0 on Android 6.0 rc2+, system still treats hardware clock as local time but no longer updates the hardware clock correspondingly even if I change the time manually

The code is so simple.
I can't see what wrong it is.
You could read the code and debug yourself:

https://osdn.net/projects/android-x86/scm/git/system-core/commits/0c5a38b45089f731d6e54b8a3fd62d097a045164
https://osdn.net/projects/android-x86/scm/git/frameworks-base/commits/14c02a77592da2a4ab307ab170d2f5be305de33d

dgdn

unread,
Oct 5, 2016, 12:01:26 PM10/5/16
to Android-x86

youling 257

unread,
Oct 5, 2016, 12:39:00 PM10/5/16
to Android-x86
I am using  [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation] "RealTimeIsUniversal"=qword:00000000 ,

ubuntu and androidx86 , i'm use hwclock -w --localtime

在 2016年10月6日星期四 UTC+8上午12:01:26,dgdn写道:

David Martens

unread,
Jan 19, 2017, 10:54:52 AM1/19/17
to Android-x86
I had similar trouble with the system saving the time to the RTC as UTC but interpreting it as local time on boot. It looks like the issue is caused by the negation of the second term in the following condition from system/core/init/builtins.cpp:

"if (persist_property_get("persist.rtc_local_time", hwtime_mode) && !strcmp(hwtime_mode, "1")) {"

This is checking if the hwtime_mode is not local time while it intends to check if hwtime_mode is local time.

Chih-Wei Huang

unread,
Jan 19, 2017, 11:07:31 AM1/19/17
to Android-x86
The logic is apparently correct.
It means hwtime_mode (i.e., persist.rtc_local_time property) is 1
which means the it's local time.
See man strcmp if you still don't understand it.
(ref: https://linux.die.net/man/3/strcmp)
Reply all
Reply to author
Forward
0 new messages