Simplify code of weekday calculation

This commit is contained in:
Thomas Basler
2025-03-22 14:45:51 +01:00
parent 3e22669031
commit a17cf532d4

View File

@@ -1,15 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
/* /*
* Copyright (C) 2023 Thomas Basler and others * Copyright (C) 2023-2025 Thomas Basler and others
*/ */
#include "Utils.h" #include "Utils.h"
#include <time.h> #include <time.h>
uint8_t Utils::getWeekDay() uint8_t Utils::getWeekDay()
{ {
time_t raw; time_t now = time(NULL);
struct tm info; struct tm tm = *localtime(&now);
time(&raw); return tm.tm_mday;
localtime_r(&raw, &info);
return info.tm_mday;
} }