Skip to content
Snippets Groups Projects
Commit 4e8b5040 authored by Γιώργος Σκλαβενίτης's avatar Γιώργος Σκλαβενίτης Committed by steltze
Browse files

utc template function

parent 93003c82
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
#include <cstdint>
#include <etl/String.hpp>
#include "Time.hpp"
#include "Logger.hpp"
/**
* A class that represents a UTC time and date according to ISO 8601
......@@ -131,3 +132,9 @@ private:
return daysOfMonth;
}
};
/*
* Specifying the convertValueToString function to UTCTimestamp type of value -- definition in "Logger.hpp"
*/
template <>
void convertValueToString(String<LOGGER_MAX_MESSAGE_SIZE>& message, UTCTimestamp& value);
\ No newline at end of file
......@@ -161,3 +161,18 @@ void UTCTimestamp::repair() {
year++;
}
}
template <>
void convertValueToString(String<LOGGER_MAX_MESSAGE_SIZE>& message, UTCTimestamp& value){
etl::to_string(value.hour, message, true);
message += "-";
etl::to_string(value.minute, message, true);
message += "-";
etl::to_string(value.second, message, true);
message += " -- ";
etl::to_string(value.day, message, true);
message += "/";
etl::to_string(value.month, message, true);
message += "/";
etl::to_string(value.year, message, true);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment