Exemplo n.º 1
0
def _is_time_in_today(time_to_check):
    """ checks if the given timestamp is inside today """    
    today_timestamps = misc_utils.get_start_and_end_of_day(_get_current_datetime())
    #print 'TODAY is time ' + str(time_to_check) + ' between ' + str(today_timestamps[0]) + ' and ' + str(today_timestamps[1])
    return (time_to_check >= today_timestamps[0]) & (time_to_check < today_timestamps[1])
Exemplo n.º 2
0
def _is_time_in_tomorrow(time_to_check):
    """ checks if the given timestamp is inside the day after today """ 
    tomorrow_timestamps = misc_utils.get_start_and_end_of_day(_get_current_datetime() + datetime.timedelta(0,misc_utils.SECONDS_IN_DAY)) 
    return (time_to_check >= tomorrow_timestamps[0]) & (time_to_check < tomorrow_timestamps[1])
Exemplo n.º 3
0
 def test_get_start_end_of_day(self):
     a_datetime = datetime.datetime(2014,01,31,17,33,12).strftime("%s")        
     results = misc_utils.get_start_and_end_of_day(a_datetime)
     # hardcoded values that are known to be correct
     assert results[0] == 1391122800
     assert results[1] == 1391209199