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
@ -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…
Reference in New Issue
Block a user