Index: trunk/fundraiser-statistics/fundraiser-scripts/classes/TimestampProcessor.py |
— | — | @@ -45,8 +45,28 @@ |
46 | 46 | import math |
47 | 47 | import Fundraiser_Tools.classes.Helper as mh |
48 | 48 | |
| 49 | +""" |
| 50 | + Get timestamps for interval |
49 | 51 | |
| 52 | + INPUT: |
| 53 | + start_time_obj - a datetime object indicating the start of the interval |
50 | 54 | """ |
| 55 | +def timestamps_for_interval(start_time_obj, timestamp_format, **kwargs): |
| 56 | + |
| 57 | + for key in kwargs: |
| 58 | + |
| 59 | + if key == 'minutes': |
| 60 | + end_time_obj = start_time_obj + datetime.timedelta(minutes=kwargs[key]) |
| 61 | + elif key == 'hours': |
| 62 | + end_time_obj = start_time_obj + datetime.timedelta(hours=kwargs[key]) |
| 63 | + |
| 64 | + start_timestamp = timestamp_from_obj(start_time_obj, timestamp_format, 3) |
| 65 | + end_timestamp = timestamp_from_obj(end_time_obj, timestamp_format, 3) |
| 66 | + |
| 67 | + return [start_timestamp, end_timestamp] |
| 68 | + |
| 69 | + |
| 70 | +""" |
51 | 71 | |
52 | 72 | Takes a list of timestamps as input and converts it to a set of days, hours, or minutes counting back from 0 |
53 | 73 | |