27 #ifndef __RADAR_ODIMH5V21_FORMAT_HPP__ 28 #define __RADAR_ODIMH5V21_FORMAT_HPP__ 70 snprintf(buff,
sizeof(buff),
"%04d%02d%02d", year, month, day);
73 catch (std::exception& e)
75 std::ostringstream ss;
76 ss <<
"Cannot convert value '" << value <<
"' to a string: " << e.what();
105 snprintf(buff,
sizeof(buff),
"%02d%02d%02d", hour, min, sec);
108 catch (std::exception& e)
110 std::ostringstream ss;
111 ss <<
"Cannot convert value '" << value <<
"' to a string: " << e.what();
137 int hour, min, sec, msec;
140 snprintf(buff,
sizeof(buff),
"%02d%02d%02d.%03d", hour, min, sec, msec);
143 catch (std::exception& e)
145 std::ostringstream ss;
146 ss <<
"Cannot convert value '" << value <<
"' to a string: " << e.what();
161 int year, month, day;
162 if (sscanf(value.c_str(),
"%04d%02d%02d", &year, &month, &day) != 3)
166 catch (std::invalid_argument& iae)
183 if (sscanf(value.c_str(),
"%02d%02d%02d", &hour, &min, &sec) != 3)
187 catch (std::invalid_argument& iae)
202 if (sscanf(value.c_str(),
"%lf", &dvalue) != 1)
204 long integer = (long)(dvalue * 1000);
205 integer = integer % 240000000;
206 long msec = integer % 1000; integer /= 1000;
207 long sec = integer % 100;
208 long min = (integer / 100) % 100;
209 long hour = integer / 10000;
210 return (
double)(hour * 3600 + min * 60 + sec) + ((
double)msec / 1000);
time_t mktime(int year, int month, int day)
Create a time from a date.
Definition: time.cpp:110
OdimH5 generic error.
Definition: odimh5v21_exceptions.hpp:52
Namespace related to ODIMH5 version 2.1.
Definition: odimh5v21.hpp:46
Interface classes between OdimH5 objects and HDF5 library.
Functions about times and dates.
void splitHMS(time_t absolute, int &hour, int &min, int &sec)
Extract day time informations from a time_t value.
Definition: time.cpp:197
Functions for string manipulation and conversion.
void splitYMD(time_t absolute, int &year, int &month, int &day)
Extract date informations from a time_t value.
Definition: time.cpp:178
Constants and values used by OdimH5 library.