mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-17 15:49:51 +01:00
Simplify code of weekday calculation
This commit is contained in:
@@ -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;
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user