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

Function sec_to_time

sql/item_timefunc.cc:102–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100*/
101
102static bool sec_to_time(lldiv_t seconds, MYSQL_TIME *ltime)
103{
104 int warning= 0;
105
106 set_zero_time(ltime, MYSQL_TIMESTAMP_TIME);
107
108 if (seconds.quot < 0 || seconds.rem < 0)
109 {
110 ltime->neg= 1;
111 seconds.quot= -seconds.quot;
112 seconds.rem= -seconds.rem;
113 }
114
115 if (seconds.quot > TIME_MAX_VALUE_SECONDS)
116 {
117 set_max_hhmmss(ltime);
118 return true;
119 }
120
121 ltime->hour= (uint) (seconds.quot / 3600);
122 uint sec= (uint) (seconds.quot % 3600);
123 ltime->minute= sec / 60;
124 ltime->second= sec % 60;
125 time_add_nanoseconds_with_round(ltime, seconds.rem, &warning);
126
127 adjust_time_range(ltime, &warning);
128
129 return warning ? true : false;
130}
131
132
133/*

Callers

nothing calls this directly

Calls 4

set_zero_timeFunction · 0.85
set_max_hhmmssFunction · 0.85
adjust_time_rangeFunction · 0.85

Tested by

no test coverage detected