bulubula commited on
Commit
1b622c4
·
1 Parent(s): fcfc619
Files changed (1) hide show
  1. utils.py +5 -4
utils.py CHANGED
@@ -28,13 +28,13 @@ def get_competitions(CONFIG_URL):
28
 
29
  def get_latest_evaluation_time(evaluation_times):
30
  """
31
- Get the latest UTC evaluation time as a datetime object (either today or yesterday).
32
 
33
  Args:
34
  evaluation_times (list): List of evaluation times as strings (in HH:MM format).
35
 
36
  Returns:
37
- datetime: Latest evaluation time as a datetime object.
38
  """
39
 
40
  # Get the current UTC date and time
@@ -50,8 +50,9 @@ def get_latest_evaluation_time(evaluation_times):
50
  # Loop through the evaluation times in reverse to find the latest time that has passed
51
  for eval_time in reversed(eval_times):
52
  if current_utc_time >= eval_time:
53
- # If the time has passed today, return today's date with that time
54
- return current_utc_datetime.replace(hour=eval_time.hour, minute=eval_time.minute, second=0, microsecond=0)
 
55
 
56
  # If none of the evaluation times have passed, return the latest one from the previous day
57
  yesterday = current_utc_datetime - timedelta(days=1)
 
28
 
29
  def get_latest_evaluation_time(evaluation_times):
30
  """
31
+ Get the latest UTC evaluation time as a pandas Timestamp (with dtype=datetime64[ns, UTC]).
32
 
33
  Args:
34
  evaluation_times (list): List of evaluation times as strings (in HH:MM format).
35
 
36
  Returns:
37
+ pd.Timestamp: Latest evaluation time as a pandas Timestamp with timezone UTC.
38
  """
39
 
40
  # Get the current UTC date and time
 
50
  # Loop through the evaluation times in reverse to find the latest time that has passed
51
  for eval_time in reversed(eval_times):
52
  if current_utc_time >= eval_time:
53
+ # If the time has passed today, return today's date with that time as pd.Timestamp
54
+ latest_time = current_utc_datetime.replace(hour=eval_time.hour, minute=eval_time.minute, second=0, microsecond=0)
55
+ return pd.Timestamp(latest_time, tz='UTC')
56
 
57
  # If none of the evaluation times have passed, return the latest one from the previous day
58
  yesterday = current_utc_datetime - timedelta(days=1)