Logo Pico-Framework A web-first embedded framework for C++
Loading...
Searching...
No Matches
TimeOfDayJson.h
Go to the documentation of this file.
1#include "time/TimeOfDay.h"
2#include <nlohmann/json.hpp>
3
4inline void to_json(nlohmann::json& j, const TimeOfDay& t) {
5 j = TimeOfDay::toString(t); // Convert TimeOfDay to string
6}
7
8
9inline void from_json(const nlohmann::json& j, TimeOfDay& t) {
10 t = TimeOfDay::fromString(j.get<std::string>().c_str());
11}
void from_json(const nlohmann::json &j, TimeOfDay &t)
void to_json(nlohmann::json &j, const TimeOfDay &t)
A simple representation of wall-clock time (HH:MM or HH:MM:SS)
A simple value type representing a time of day (hour, minute, second).
Definition TimeOfDay.h:22
static TimeOfDay fromString(const char *hhmm)
Parse a string in the form "HH:MM" or "HH:MM:SS".
Definition TimeOfDay.h:32
static std::string toString(const TimeOfDay &time)
Format the time as a string.
Definition TimeOfDay.h:48