22 lines
		
	
	
		
			680 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			680 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import time
 | |
| from datetime import datetime, timedelta
 | |
| 
 | |
| 
 | |
| def get_current_time():
 | |
|     """Returns the current time in seconds since the epoch."""
 | |
|     return time.time()
 | |
| 
 | |
| 
 | |
| def generate_timestrings(start_time_str, end_time_str, dt):
 | |
|     """Generates a list of timestamps from start_time to end_time, which are strings such
 | |
|     as 19:00."""
 | |
| 
 | |
|     timestamps = []
 | |
|     current_time = datetime.strptime(start_time_str, "%H:%M")
 | |
|     end_time = datetime.strptime(end_time_str, "%H:%M")
 | |
|     while current_time <= end_time:
 | |
|         timestamps.append(current_time)
 | |
|         current_time += timedelta(seconds=dt)
 | |
|     timestrings = [dt.strftime("%H:%M") for dt in timestamps]
 | |
|     return timestrings
 |