mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-10-18 02:58:41 +00:00
alarm: using timegm instead of mktime beacuse rtc is gmt time
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
fe28ed0520
commit
6e3c4aab7d
1 changed files with 3 additions and 3 deletions
|
|
@ -334,14 +334,14 @@ int main(int argc, FAR char *argv[])
|
|||
* alarm expiring in year 1900.
|
||||
*/
|
||||
|
||||
timeleft = mktime((struct tm *)&rd.time) - now;
|
||||
timeleft = timegm((struct tm *)&rd.time) - now;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct tm now_tm;
|
||||
|
||||
/* Periodic extend "partial" alarms by "unfolding" months,
|
||||
* until we get alarm that is in future. Note that mktime()
|
||||
* until we get alarm that is in future. Note that timegm()
|
||||
* normalizes fields that are out of their valid values,
|
||||
* so we don't have to handle carry to tm_year by ourselves.
|
||||
*/
|
||||
|
|
@ -352,7 +352,7 @@ int main(int argc, FAR char *argv[])
|
|||
|
||||
do
|
||||
{
|
||||
timeleft = mktime((struct tm *)&rd.time) - now;
|
||||
timeleft = timegm((struct tm *)&rd.time) - now;
|
||||
if (timeleft < 0)
|
||||
{
|
||||
rd.time.tm_mon++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue