[Q] Hardware rtc (clock) incorrect

Search This thread

alvinhochun

Senior Member
Oct 3, 2010
175
202
There's something fishy happening on my Xperia M (C1905).

Basically, the current time fails to be written to the hardware rtc, so the device is only counting on the time sync through network at boot.
Also, because the hardware rtc is out of sync, alarms won't fire up when the device is powered off.

Part of the kernel messages:

Code:
$ adb shell su -c dmesg | less
...
[    1.510056] using rtc device, pm8xxx_rtc, for alarms
[    1.510117] rtc-pm8xxx rtc-pm8xxx: rtc core: registered pm8xxx_rtc as rtc0
...
[    1.925286] rtc-pm8xxx rtc-pm8xxx: setting system clock to 1970-01-26 00:2
7:36 UTC (2161656)
...
[    8.209980] alarm_set_rtc: Failed to set RTC, time will be lost on reboot
...
[   32.398962] alarm_set_rtc: Failed to set RTC, time will be lost on reboot
...

Execution of some commands in the shell:

Code:
root@android:/ # date
Sat Oct 12 21:54:53 HKT 2013
root@android:/ # hwclock
Mon Jan 26 00:53:36 1970  0.000000 seconds
root@android:/ # hwclock -w
hwclock: RTC_SET_TIME: Invalid argument
1|root@android:/ #

There is only one rtc device under /dev, which is /dev/rtc0.

This problem really bothers me. Not only I will need to keep device on to get alarms firing, but also the operations done in CWM will have wrong timestamps.

I would like to know if anyone else having an Xperia M/M Dual have the same problem. Check by doing what I did, or set an alarm, power off and see if the alarm fires.
 
Last edited:
  • Like
Reactions: Bonoboo

alvinhochun

Senior Member
Oct 3, 2010
175
202
More insight:

The hardware rtc is at about 26 days after Unix epoch. My guess is that if the rtc actually resets, it will start at the Unix epoch, so that indicates that last reset of rtc is about 26 days ago.

Now the problem is that I don't remember the exact date I get the phone. After I got the phone, I actually did a few factory resets. If I know if the rtc starts before or after I get the phone, it will help to determine if this problem exists already when manufactured. But 26 days ago is pretty close to when I got the phone.

Sent from my Sony Xperia M (C1905)
 

icoolguy1995

Senior Member
Jun 22, 2012
2,188
1,502
HARDA
More insight:

The hardware rtc is at about 26 days after Unix epoch. My guess is that if the rtc actually resets, it will start at the Unix epoch, so that indicates that last reset of rtc is about 26 days ago.

Now the problem is that I don't remember the exact date I get the phone. After I got the phone, I actually did a few factory resets. If I know if the rtc starts before or after I get the phone, it will help to determine if this problem exists already when manufactured. But 26 days ago is pretty close to when I got the phone.

Sent from my Sony Xperia M (C1905)

Hmm thats interesting. I think problem will be solved after flashing 4.2.2 its a guess but it might work.

Sent from my C1904 using XDA Premium 4 mobile app
 

alvinhochun

Senior Member
Oct 3, 2010
175
202
OK, I found the cause of the problem.

It appears that Sony intentionally or unintentionally didn't enable the function to write to the hardware rtc. (See kernel source: https://github.com/alvinhochun/sony...ster/arch/arm/mach-msm/board-8930-pmic.c#L297)

What I need to do is to change `rtc_write_enable` to `true` and compile the kernel. After that the hardware rtc can finally be updated.



For the alarm, I thought the reason is similar, but even when I set `rtc_alarm_powerup` to `true` it didn't power on with alarm set. Perhaps this is a feature missing from Android, so never mind.
 

Mr. Hostel

New member
May 11, 2011
1
0
OK, I found the cause of the problem.

It appears that Sony intentionally or unintentionally didn't enable the function to write to the hardware rtc.

What I need to do is to change `rtc_write_enable` to `true` and compile the kernel. After that the hardware rtc can finally be updated.



For the alarm, I thought the reason is similar, but even when I set `rtc_alarm_powerup` to `true` it didn't power on with alarm set. Perhaps this is a feature missing from Android, so never mind.

i've got the same problem with my xperia s. can you tell me how to change rtc_write_enable in kernel?
 
Nov 12, 2013
10
5
Dear,
You cant update your rtc unless u find way modify your bootloader which is ta because after unlocking bootloader load address offsets to some place else if you have ta backup you can check date of grub rck_h in hex editor but don't try to change it manually as it is associated with cert installed of locked bootloader if you have ASOP in external grub folder you have option for set date but you should have unlocked bootloader or else you should be able to inverse the effect of bootloader unlock from adb which will return it to factory state or final option you should have command line for factory image building with every parameter in it.
I am also quest for it?
please urge other members for cmdline from /proc if there ta is intact.
so we may figure out how to make factory image from asop.

please let me know if you find anything
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    There's something fishy happening on my Xperia M (C1905).

    Basically, the current time fails to be written to the hardware rtc, so the device is only counting on the time sync through network at boot.
    Also, because the hardware rtc is out of sync, alarms won't fire up when the device is powered off.

    Part of the kernel messages:

    Code:
    $ adb shell su -c dmesg | less
    ...
    [    1.510056] using rtc device, pm8xxx_rtc, for alarms
    [    1.510117] rtc-pm8xxx rtc-pm8xxx: rtc core: registered pm8xxx_rtc as rtc0
    ...
    [    1.925286] rtc-pm8xxx rtc-pm8xxx: setting system clock to 1970-01-26 00:2
    7:36 UTC (2161656)
    ...
    [    8.209980] alarm_set_rtc: Failed to set RTC, time will be lost on reboot
    ...
    [   32.398962] alarm_set_rtc: Failed to set RTC, time will be lost on reboot
    ...

    Execution of some commands in the shell:

    Code:
    root@android:/ # date
    Sat Oct 12 21:54:53 HKT 2013
    root@android:/ # hwclock
    Mon Jan 26 00:53:36 1970  0.000000 seconds
    root@android:/ # hwclock -w
    hwclock: RTC_SET_TIME: Invalid argument
    1|root@android:/ #

    There is only one rtc device under /dev, which is /dev/rtc0.

    This problem really bothers me. Not only I will need to keep device on to get alarms firing, but also the operations done in CWM will have wrong timestamps.

    I would like to know if anyone else having an Xperia M/M Dual have the same problem. Check by doing what I did, or set an alarm, power off and see if the alarm fires.