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