def checkTime(self, startTime, endTime, context):

        timestamp_start = datetime.datetime.fromtimestamp(startTime)
        #print timestamp_start.strftime('%Y-%m-%d %H:%M')
        start_hour = int(timestamp_start.strftime('%H'))
        start_minute = int(timestamp_start.strftime('%M'))
        start_time = datetime.datetime.now().replace(hour=start_hour, minute=start_minute, second=0, microsecond=0)
        start_day = timestamp_start.weekday()
        timestamp_end = datetime.datetime.fromtimestamp(endTime)
        end_hour = int(timestamp_end.strftime('%H'))
        end_minute = int(timestamp_end.strftime('%M'))
        end_time = datetime.datetime.now().replace(hour=end_hour, minute=end_minute, second=0, microsecond=0)
        end_day = timestamp_end.weekday()

        timeFlag = False
        dayFlag = True

        context_start = [int(start.strip()) for start in context.context_duration_start.split(':')]
        context_start_hour = context_start[0]
        context_start_minute = context_start[1]
        context_start_time = datetime.datetime.now().replace(hour=context_start_hour, minute=context_start_minute, second=0, microsecond=0)

        context_end = [int(end.strip()) for end in context.context_duration_end.split(':')]
        context_end_hour = context_end[0]
        context_end_minute = context_end[1]
        context_end_time = datetime.datetime.now().replace(hour=context_end_hour, minute=context_end_minute, second=0, microsecond=0)


        if context_start_time <= start_time and end_time <= context_end_time:
            timeFlag = True

        #Python datetime: Monday = 0, Sunday = 6
        #Client code will be fixed to reflect this day ordering
        context_days = context.context_duration_days
        context_days_list = [int(x) for x in context_days[1:-1].split(',')]
        if start_day < end_day:
            start_day_temp = start_day
            while start_day_temp <= end_day:
                if context_days_list[start_day_temp] != 1:
                    dayFlag = False
                    break
                start_day_temp += 1
        elif start_day > end_day:
            start_day_temp = start_day
            while start_day_temp <= 6:
                if context_days_list[start_day_temp] != 1:
                    dayFlag = False
                    break
                start_day_temp += 1
            end_day_temp = 0
            while end_day_temp <= end_day:
                if context_days_list[end_day_temp] != 1:
                    dayFlag = False
                    break
                end_day_temp += 1
        else:
            if context_days_list[start_day] != 1:
                dayFlag = False
        #print "dayFlag, timeFlag: %s, %s"%(dayFlag, timeFlag)
        return dayFlag and timeFlag
dataset/ETHPy150Open HumanDynamics/openPDS/openpds/accesscontrol/internal.py/AccessControlledInternalDataStore.checkTime/original