This commit is contained in:
Yuri Trikoz
2020-06-27 01:21:58 +03:00
parent b51ec4d0e2
commit 00fd9f9bb9
14 changed files with 371 additions and 266 deletions

View File

@@ -24,7 +24,7 @@ class PrintMessage {
private:
void print(const ErrorLevel_t level, const String& str) {
Serial.printf("%s [%s] [%s] %s\n", prettyMillis().c_str(), getErrorLevelStr(level).c_str(), _module, str.c_str());
Serial.printf("%s [%s] [%s] %s\n", prettyMillis(millis()).c_str(), getErrorLevelStr(level).c_str(), _module, str.c_str());
}
private:

View File

@@ -1,37 +1,15 @@
#pragma once
#ifdef ESP8266
#include <time.h>
#endif
#include <Arduino.h>
/*
* Получение текущего времени
*/
String getTime();
#include "CommonTypes.h"
/*
* Получаем время в формате linux gmt
*/
String getTimeUnix();
/*
* Параметр время
* @result результат
*/
boolean getUnixTimeStr(String&);
String getTimeWOsec();
/*
* Получение даты
*/
String getDate();
String getDateDigitalFormated();
int timeToMin(String Time);
const String prettyMillis(unsigned long time_ms = millis());
#define ONE_MINUTE_s 60
#define ONE_HOUR_m 60
#define ONE_HOUR_s 60 * ONE_MINUTE_s
#define LEAP_YEAR(Y) (((1970 + Y) > 0) && !((1970 + Y) % 4) && (((1970 + Y) % 100) || !((1970 + Y) % 400)))
#define MIN_DATETIME 1575158400
#define ONE_SECOND_ms 1000
/*
* Время (мс) прошедщее с @since
@@ -43,6 +21,31 @@ unsigned long millis_since(unsigned long sinse);
*/
unsigned long millis_passed(unsigned long start, unsigned long finish);
/*
* Форматиронное время интервала (мс)
* "чч:мм:cc",
* "дд чч:мм", если > 24 часов
*/
const String prettyMillis(unsigned long time_ms = millis());
/*
* Форматиронное время интервала (c)
* "чч:мм:cc",
* "дд чч:мм", если > 24 часов
*/
const String prettySeconds(unsigned long time_s);
/*
* Тайм зона в секундах
*/
int getOffsetInSeconds(int timezone);
/*
* Тайм зона в минутах
*/
int getOffsetInMinutes(int timezone);
/*
* Разбивает время на составляющие
*/
void breakEpochToTime(unsigned long epoch, Time_t& tm);