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
/*
* Copyright (C) 2023 Thomas Basler and others
* Copyright (C) 2023-2025 Thomas Basler and others
*/
#include "Utils.h"
#include <time.h>
uint8_t Utils::getWeekDay()
{
time_t raw;
struct tm info;
time(&raw);
localtime_r(&raw, &info);
return info.tm_mday;
}
time_t now = time(NULL);
struct tm tm = *localtime(&now);
return tm.tm_mday;
}