1. Technical Field
The present disclosure relates to electronic devices, and particularly, to an electronic device with a system time setting function and a method thereof.
2. Description of Related Art
The system time of some electronic devices, for example mobile phones, may be lost when the batteries of the electronic devices are taken out. When the electronic devices are powered on again, the system time may be inconsistent with the standard time, thus users have to go through the trouble of resetting the system time which may include year, month, date, and time.
Many aspects of the present disclosure may be better understood with reference to the following drawings. The components in the drawings are not necessarily drawn to scale, the emphasis instead being placed upon clearly illustrating the principles of the present disclosure. Moreover, in the drawings, like reference numerals designate corresponding parts throughout the several views.
Embodiments of the present disclosure will now be described in detail below, with reference to the accompanying drawings.
Referring to
When the electronic device 100 is in the power-on state, the processing module 30 obtains the system time T0, the measured remaining battery capacity C1, and the time elapsed since the start of the most recent timing (oscillation time T1) by the crystal oscillator 1011, and updates the storage module 40 to store the currently obtained system time T0, the currently measured remaining battery capacity C1, and the current oscillation time T1 in the storage module 40. In this embodiment, the storage module 40 further stores a battery capacity consumption value C0 which records a rate of loss of battery capacity per hour of the battery module 10 when the battery 10 is not supplying power to the electronic device 100, for example, when the battery 10 has been taken out of the electronic device 100. The processing module 30 further obtains the battery identifier of the battery module 10 mounted therein once the electronic device 100 is powered on, and updates the storage module 40 to store any data from the currently obtained battery identifier in the storage module 40 if no battery identifier exists in the storage module 40, or if the previously stored data from the battery identifier is shown to be different from that of the currently identifier.
When the electronic device 100 is powered on, the processing module 30 determines whether the battery module 10 currently existing in the electronic device 100 is different from the battery module 10 previously existing in the electronic device 100, that is, it determines whether the battery module 10 has been changed. If the battery module 10 has been changed, the processing module 30 obtains a current oscillation time T2 from the gauge IC 101, and calculates the time length for which the electronic device 100 has been powered-off according to the current oscillation time T2 and the stored oscillation time T1, where the length of time may be equal to the current oscillation time T2 minus the stored oscillation time T1 if T2>T1, or equal to a total of 65,535 seconds and the value of the current oscillation time T2 minus the stored oscillation time T1, if T2<T1. The processing module 30 further compares the current remaining battery capacity C2 of the battery module 10 with the stored remaining battery capacity C1, and determines the current system Te according to the length of time, the stored system time T0, the comparison result between the current remaining battery capacity C2 and the stored remaining battery capacity C1, and the battery capacity consumption value C0. In this embodiment, the processing module 30 further generates a prompt to the user to reset the system time based on the calculated current system time Te. In the execution of such a function, the current system time Te may be not totally accurate, but users only need to reset the minutes or seconds to regulate, or re-regulate, the current system Te to obtain the system time Te without being required to reset the year, the date, and the hour.
In this embodiment, when the electronic device 100 is powered on, the processing module 30 obtains data from the battery identifier of the battery module 10 currently existing in the electronic device 100, and determines whether the currently obtained data from the battery identifier is different from that of the stored battery identifier. If it is not, the electronic device 100 determines that the battery module 10 is unchanged. If it is, the electronic device 100 determines that the battery module 10 has been changed, and replaces the previously stored data as to the battery identifier with the currently obtained data from the battery identifier. In this embodiment, if the electronic device 100 determines that the battery module 10 has been changed when the electronic device 100 is powered on, the processing module 30 sets a total of the stored system time T0 plus a predetermined time as the current system time Te. In this embodiment, the predetermined time may be an average time of a user changing the battery module 10, for example 60 seconds.
In this embodiment, if the processing module 30 determines that the battery module 10 is not changed, when the electronic device 100 is powered on, the processing module 30 obtains the current remaining battery capacity C2 and the current oscillation time T2 from the gauge IC 101.
The processing module 30 determines whether the current remaining battery capacity C2 is greater than the stored remaining battery capacity C1, and whether the current oscillation time T2 is greater than the stored oscillation time T1. If the current remaining battery capacity C2 is greater than the stored remaining battery capacity C1 and the current oscillation time T2 is greater than the oscillation time T1, the processing module 30 determines the current system time according to the formula Te=T0+(T2−T1). If the current remaining battery capacity C2 is greater than the stored battery capacity C1 and the current oscillation time T2 is less than the stored oscillation time T1, the processing module 30 determines the current time according to the formula Te=T0+65535+(T2−T1).
If the current remaining battery capacity C2 is less than the stored remaining battery capacity C1 and the current oscillation time T2 is greater than the stored oscillation time T1, the processing module 30 determines a battery discharge time Tc=(C1−C2)/C0, where Tc is measured in hours, and determines the current system time Te according to the formula Te=[Tc div 18]*65535+T0+(T2−T1), here, div represents an integer division. If the current oscillation time T2 is less than the stored oscillation time T1, the processing module 30 determines the current system time Te according to the formula Te=[Tc div 18]*65535+T0+65535+(T2−T1).
In step S201, the processing module 30 obtains the system time T0, the currently measured remaining battery capacity C1, and the oscillation time T1 generated by the crystal oscillator 1011 every predetermined time interval when the electronic device 100 is in an power-on state, and updates the storage module 40 to store the currently obtained system time T0, the currently measured remaining battery capacity C1, and the current oscillation time T1 in the storage module 40.
In step S202, when the device 100 is powered on, the processing module 30 obtains the battery identifier data concerning the battery module 10 currently existing in the electronic device 100, and determines whether the currently obtained data is different from the stored data. If it is, the procedure goes to step S203; if it is not, the procedure goes to step S204.
In step S203, when the electronic device 100 is powered on, the processing module 30 sets the total of the stored system time T0 plus a predetermined time T3 as the current system time Te.
In step S204, the processing module 30 obtains a current remaining battery capacity C2 from the gauge IC 101 and determines whether the current batter capacity C2 is greater than the stored remaining battery capacity C1. If it is, the procedure goes to step S205, otherwise the procedure goes to step S208.
In step S205, the processing module 30 obtains a current oscillation time T2, and determines whether the current oscillation time T2 is greater than the stored oscillation time T1, if it is, the procedure goes to step S206; if it is not, the procedure goes to step S207.
In step S206, the processing module 30 determines the current system time according to the formula Te=T0+(T2−T1).
In step S207, the processing module 30 determines the current system time according to the formula Te=T0+65535+(T2−T1).
In step S208, the processing module 30 determines whether the current oscillation time T2 is greater than the stored oscillation time T1, if it is, the procedure goes to step S209; otherwise, the procedure goes to step S210.
In step S209, the processing module 30 determines a battery discharge time as Tc=(C2−C1)/C0, and determines the current system time according to the formula Te=[Tc div 18]*65535+T0+(T2−T1).
In step S210, the processing module 30 determines the current system time according to the formula Te=[Tc div 18]*65535+T0+65535+(T2−T1).
In step S211, the processing module 30 generates a prompt to the user to reset the system time base on the current system time Te.
The present embodiments and their advantages will be understood from the foregoing description, and it will be apparent that various changes may be made thereto without departing from the spirit and scope of the disclosure or sacrificing all of its material advantages, the examples hereinbefore described merely being exemplary embodiments of the disclosure.
Number | Date | Country | Kind |
---|---|---|---|
201110094683.8 | Apr 2011 | CN | national |