| 899 | VALID_RANGE(0, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1)); |
| 900 | |
| 901 | static bool update_timestamp(THD *thd, set_var *var) |
| 902 | { |
| 903 | if (var->value) |
| 904 | { |
| 905 | double fl= floor(var->save_result.double_value); // Truncate integer part |
| 906 | struct timeval tmp; |
| 907 | tmp.tv_sec= (ulonglong) fl; |
| 908 | /* Round nanoseconds to nearest microsecond */ |
| 909 | tmp.tv_usec= (ulonglong) rint((var->save_result.double_value - fl) * 1000000); |
| 910 | thd->set_time(&tmp); |
| 911 | } |
| 912 | else // SET timestamp=DEFAULT |
| 913 | { |
| 914 | thd->user_time.tv_sec= 0; |
| 915 | thd->user_time.tv_usec= 0; |
| 916 | } |
| 917 | return false; |
| 918 | } |
| 919 | static double read_timestamp(THD *thd) |
| 920 | { |
| 921 | return (double) thd->start_time.tv_sec + |