我编码闹钟应用程序,我想知道发生什么事,当我在时间上午02时59分设置一些报警与AlarmManager为例(这不是我的闹钟时间,这是唯一的一次,当我设置一些报警)和凌晨3:00将有来自夏时制时间自动切换到冬季(DST)。我的计划报警,会发生什么?我发现没有什么文档,它不是那么容易测试,至少我要更改日期,等待几个小时......我没有这么耐心;)
I'm coding an alarm clock application, and i would like to know what happens, when I set some alarm with AlarmManager for example at time 2:59am (this is not time of my alarm, this is only time WHEN i set some alarm), and at 3:00am there will be automatic time change from summer time to winter (DST). What happens with my scheduled alarm? I found nothing in docs, and it's not so easy to test, at least I must change dates and wait few hours...I'm not so patient ;)
接下来的问题 - 我也很好奇,会发生什么我报警与AlarmManager设置当用户更改时区。这是幸运pretty容易测试,我发现,Android是pretty智能,并自动重新安排报警。所以,当我在时区为例如9:00,我设置10:00报警,并切换时区(+1小时),其中实际时间是上午10点,重新安排的android我的闹钟到11点,符合市场预期。这是很细的,但是,我并没有发现什么也文档中...
Next problem - I was also curious, what happens with my alarms set with AlarmManager when user changes timezone. This was luckily pretty easy to test, and I found, that android is pretty "intelligent" and reschedule alarm automatically. So when in my timezone is for example 9:00 and i set alarm on 10:00, and switch timezone (+1 hours) where actual time is 10:00, android reschedule my alarm to 11:00, as expected. This is very fine, however, i didn't found also anything in docs...
任何人有更多的官方信息? THX
Anybody has more official information? Thx
推荐答案RTC 和 RTC_WAKEUP 使用 System.currentTimeMillis的()作为时基,这是UTC时间,因此是独立的时区的变化,夏令时的变化,等等。
RTC and RTC_WAKEUP use System.currentTimeMillis() as the timebase, which is in UTC time and therefore is independent of time zone changes, daylight savings time changes, etc.
更多推荐
Android的AlarmManager和DST /时区/时间的变化?
发布评论