1184
1184
return is_valid();
1187
void Time::to_string(char *to, size_t *to_len) const
1190
, "%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32
1196
void Date::to_string(char *to, size_t *to_len) const
1199
, "%04" PRIu32 "-%02" PRIu32 "-%02" PRIu32
1205
void DateTime::to_string(char *to, size_t *to_len) const
1187
int Time::to_string(char *to, size_t to_len) const
1189
return snprintf(to, to_len,
1190
"%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32,
1191
_hours, _minutes, _seconds);
1194
int Date::to_string(char *to, size_t to_len) const
1196
return snprintf(to, to_len,
1197
"%04" PRIu32 "-%02" PRIu32 "-%02" PRIu32,
1198
_years, _months, _days);
1201
int DateTime::to_string(char *to, size_t to_len) const
1207
1203
/* If the temporal has a microsecond component, use a slightly different output */
1208
1204
if (_useconds == 0)
1211
, "%04" PRIu32 "-%02" PRIu32 "-%02" PRIu32 " %02" PRIu32 ":%02" PRIu32 ":%02" PRIu32
1206
return snprintf(to, to_len,
1207
"%04" PRIu32 "-%02" PRIu32 "-%02" PRIu32
1208
" %02" PRIu32 ":%02" PRIu32 ":%02" PRIu32,
1209
_years, _months, _days,
1210
_hours, _minutes, _seconds);
1222
, "%04" PRIu32 "-%02" PRIu32 "-%02" PRIu32 " %02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ".%06" PRIu32
1214
return snprintf(to, to_len,
1215
"%04" PRIu32 "-%02" PRIu32 "-%02" PRIu32
1216
" %02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ".%06" PRIu32,
1217
_years, _months, _days,
1218
_hours, _minutes, _seconds, _useconds);
1233
void MicroTimestamp::to_string(char *to, size_t *to_len) const
1222
int MicroTimestamp::to_string(char *to, size_t to_len) const
1236
, "%04" PRIu32 "-%02" PRIu32 "-%02" PRIu32 " %02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ".%06" PRIu32
1224
return snprintf(to, to_len,
1225
"%04" PRIu32 "-%02" PRIu32 "-%02" PRIu32
1226
" %02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ".%06" PRIu32,
1227
_years, _months, _days,
1228
_hours, _minutes, _seconds, _useconds);
1246
1231
void Time::to_decimal(my_decimal *to) const