MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / update_timestamp

Function update_timestamp

sql/sys_vars.cc:901–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899 VALID_RANGE(0, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1));
900
901static 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}
919static double read_timestamp(THD *thd)
920{
921 return (double) thd->start_time.tv_sec +

Callers

nothing calls this directly

Calls 2

rintFunction · 0.85
set_timeMethod · 0.45

Tested by

no test coverage detected