Round datetime value to the given precision. @param IN/OUT ltime The value to round. @param dec Precision. @return False on success, true on error. */
| 1389 | @return False on success, true on error. |
| 1390 | */ |
| 1391 | bool my_datetime_round(MYSQL_TIME *ltime, uint dec, int *warnings) |
| 1392 | { |
| 1393 | DBUG_ASSERT(dec <= DATETIME_MAX_DECIMALS); |
| 1394 | /* Add half away from zero */ |
| 1395 | bool rc= datetime_add_nanoseconds_with_round(ltime, |
| 1396 | msec_round_add[dec], warnings); |
| 1397 | /* Truncate non-significant digits */ |
| 1398 | my_time_trunc(ltime, dec); |
| 1399 | return rc; |
| 1400 | } |
| 1401 | |
| 1402 | |
| 1403 | /** |
no test coverage detected