Skip to content

Commit

Permalink
Added 'resolution' parameter skeleton to occupied periods.
Browse files Browse the repository at this point in the history
This commit does not implement the code for the parameter.
  • Loading branch information
alanmitchell committed Jan 2, 2015
1 parent 0574e96 commit aca73c6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bmsapp/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,19 @@ def is_occupied_day(self, ts):
# return true if it is an occupied day
return day_index in self.predominantly_occupied_days

def occupied_periods(self, ts_start, ts_end):
def occupied_periods(self, ts_start, ts_end, resolution='exact'):
""" Returns a list of two-tuples identifying all of the occupied periods
falling in the range from 'ts_start' to 'ts_end', which are both Unix
timestamps. The format of the return list is:
[ (1419276095, 1419276200), (1419276300, 1419276500), etc ]
Each tuple gives the start and stop of an occupied period, using Unix
timestamps.
The 'resolution' parameter has two possible values:
'exact': occupied / unoccupied boundaries are at the exact times
specified in the schedule.
'day': occupied / unoccupied boundaries are placed on day boundaries;
the returned tuples identify occupied days but do not give within
day resolution of occupied periods.
"""

periods_list = []
Expand Down

0 comments on commit aca73c6

Please sign in to comment.