I've moved getalarms.pl to using DateTime. Contrary to the author's
recommendations I feel I need to do time manipulation in local time,
because SC alarms are local time.

Here are 2 test cases. Is this right ?

Code:
--------------------
    >> Case 1: on 29/March/2009, at 00:30:00 (Europe/Paris) -- normal to DST, 
02:00 -> 03:00  
  
  
----------------------------------------------------------------------------------------------------
  | Dow - Date & Time - UTC offset     | Time zone      | Unix Epoch | Delta    
        | Comment
  
----------------------------------------------------------------------------------------------------
  | Sat(6), 28/Mar/2009 23:30:00 +0000 | (UTC)          | 1238283000 | + 0d 00h 
00m 00s | current date
  | Sun(0), 29/Mar/2009 00:30:00 +0100 | (Europe/Paris) | 1238283000 | + 0d 00h 
00m 00s | current local date
  | Sun(0), 29/Mar/2009 00:00:00 +0100 | (Europe/Paris) | 1238281200 | - 0d 00h 
30m 00s | earliest possible date for alarms this week
  | Sat(6), 04/Apr/2009 23:59:59 +0200 | (Europe/Paris) | 1238882399 | + 6d 22h 
29m 59s | latest possible date for alarms this week
  | Sun(0), 05/Apr/2009 00:30:01 +0200 | (Europe/Paris) | 1238884201 | + 6d 23h 
00m 01s | tops any alarm including repeated ones
  
----------------------------------------------------------------------------------------------------
  | Player Nawlins, alarm 1: @7140 on day 0, repeated
  
----------------------------------------------------------------------------------------------------
  | Sun(0), 29/Mar/2009 01:59:00 +0100 | (Europe/Paris) | 1238288340 | + 0d 01h 
29m 00s | pending this week  (*)
  
----------------------------------------------------------------------------------------------------
  | Player Nawlins, alarm 2: @7200 on day 0, repeated
  
----------------------------------------------------------------------------------------------------
  | Exception: Time 02:00:00 on date 29/Mar/2009 does not exist. Alarm wouldn't 
ring ??
  
----------------------------------------------------------------------------------------------------
  | Player Nawlins, alarm 3: @10800 on day 0, repeated
  
----------------------------------------------------------------------------------------------------
  | Sun(0), 29/Mar/2009 03:00:00 +0200 | (Europe/Paris) | 1238288400 | + 0d 01h 
30m 00s | pending this week 
  
----------------------------------------------------------------------------------------------------
  | Player Montreux, alarm 1: @300 on days 0,1,6, one time
  
----------------------------------------------------------------------------------------------------
  | Sun(0), 29/Mar/2009 00:05:00 +0100 | (Europe/Paris) | 1238281500 | - 0d 00h 
25m 00s | lapsed  this week 
  | Mon(1), 30/Mar/2009 00:05:00 +0200 | (Europe/Paris) | 1238364300 | + 0d 22h 
35m 00s | pending this week 
  | Sat(6), 04/Apr/2009 00:05:00 +0200 | (Europe/Paris) | 1238796300 | + 5d 22h 
35m 00s | pending this week 
  
----------------------------------------------------------------------------------------------------
  
  Selected date Sun(0), 29/Mar/2009 01:59:00 +0100 (Europe/Paris) [1238288340] 
for RTC programming
  
  -> There is a 1 minute difference between alarm 1 and alarm 3. Hour 02 does 
not exist on this day. 
  
  
  >> Case 2: on 26/October/2008, at 00:30:00 (Europe/Paris) -- DST to normal, 
03:00 -> 02:00  
  
  
----------------------------------------------------------------------------------------------------
  | Dow - Date & Time - UTC offset     | Time zone      | Unix Epoch | Delta    
        | Comment
  
----------------------------------------------------------------------------------------------------
  | Sat(6), 25/Oct/2008 22:30:00 +0000 | (UTC)          | 1224973800 | + 0d 00h 
00m 00s | current date
  | Sun(0), 26/Oct/2008 00:30:00 +0200 | (Europe/Paris) | 1224973800 | + 0d 00h 
00m 00s | current local date
  | Sun(0), 26/Oct/2008 00:00:00 +0200 | (Europe/Paris) | 1224972000 | - 0d 00h 
30m 00s | earliest possible date for alarms this week
  | Sat(6), 01/Nov/2008 23:59:59 +0100 | (Europe/Paris) | 1225580399 | + 7d 00h 
29m 59s | latest possible date for alarms this week
  | Sun(0), 02/Nov/2008 00:30:01 +0100 | (Europe/Paris) | 1225582201 | + 7d 01h 
00m 01s | tops any alarm including repeated ones
  
----------------------------------------------------------------------------------------------------
  | Player Nawlins, alarm 1: @7140 on day 0, repeated
  
----------------------------------------------------------------------------------------------------
  | Sun(0), 26/Oct/2008 01:59:00 +0200 | (Europe/Paris) | 1224979140 | + 0d 01h 
29m 00s | pending this week  (*)
  
----------------------------------------------------------------------------------------------------
  | Player Nawlins, alarm 2: @7200 on day 0, repeated
  
----------------------------------------------------------------------------------------------------
  | Sun(0), 26/Oct/2008 02:00:00 +0100 | (Europe/Paris) | 1224982800 | + 0d 02h 
30m 00s | pending this week 
  
----------------------------------------------------------------------------------------------------
  | Player Nawlins, alarm 3: @10800 on day 0, repeated
  
----------------------------------------------------------------------------------------------------
  | Sun(0), 26/Oct/2008 03:00:00 +0100 | (Europe/Paris) | 1224986400 | + 0d 03h 
30m 00s | pending this week 
  
----------------------------------------------------------------------------------------------------
  | Player Montreux, alarm 1: @300 on days 0,1,6, one time
  
----------------------------------------------------------------------------------------------------
  | Sun(0), 26/Oct/2008 00:05:00 +0200 | (Europe/Paris) | 1224972300 | - 0d 00h 
25m 00s | lapsed  this week 
  | Mon(1), 27/Oct/2008 00:05:00 +0100 | (Europe/Paris) | 1225062300 | + 1d 00h 
35m 00s | pending this week 
  | Sat(6), 01/Nov/2008 00:05:00 +0100 | (Europe/Paris) | 1225494300 | + 6d 00h 
35m 00s | pending this week 
  
----------------------------------------------------------------------------------------------------
  
  Selected date Sun(0), 26/Oct/2008 01:59:00 +0200 (Europe/Paris) [1224979140] 
for RTC programming
  
  -> There is a 1h and 1 minute difference between alarm 1 and alarm 2. The 
first occurence of the hour 02
  is not taken into account on that day. 
--------------------


-- 
epoch1970
------------------------------------------------------------------------
epoch1970's Profile: http://forums.slimdevices.com/member.php?userid=16711
View this thread: http://forums.slimdevices.com/showthread.php?t=48521

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to