Skip to content

Commit f5a50d5

Browse files
committed
Creating DaysBeforeRace variable
1 parent 4a83353 commit f5a50d5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

F1-Notifications/raceLogic.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
#define RACE_FILE_NAME "/races.json"
55
#define CURRENT_RACE_FILE_NAME "/current_races.json"
66

7+
// path to the races schedule, needs to be updated each year
78
#define RACE_JSON_URL "https://raw.githubusercontent.com/sportstimes/f1/main/_db/f1/2025.json"
9+
// Number of days before the race to display circuit image rather than sessions schedule
10+
#define DaysBeforeRace 3
811

912
time_t nextRaceStartUtc;
1013

@@ -32,8 +35,8 @@ bool isRaceWeek(const char *sessionStartTime)
3235
// Parse date from UTC and convert to an epoch
3336
strptime(sessionStartTime, "%Y-%m-%dT%H:%M:%S", &tm);
3437

35-
time_t sixDaysBeforeRaceEpoch = mktime(&tm) - (3 * SECS_PER_DAY);
36-
return UTC.now() > sixDaysBeforeRaceEpoch;
38+
time_t DaysBeforeRaceEpoch = mktime(&tm) - (DaysBeforeRace * SECS_PER_DAY);
39+
return UTC.now() > DaysBeforeRaceEpoch;
3740
}
3841

3942
String getConvertedTime(const char *sessionStartTime, const char *timeFormat = "")

0 commit comments

Comments
 (0)