Mercurial > dropbear
comparison dbutil.c @ 1256:506f7681d0f8 coverity
merge up to date
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 15 Mar 2016 22:45:43 +0800 |
parents | 2bb4c662d1c2 |
children | 94d4038bb34c |
comparison
equal
deleted
inserted
replaced
1219:84cf9062718d | 1256:506f7681d0f8 |
---|---|
155 | 155 |
156 void debug_start_net() | 156 void debug_start_net() |
157 { | 157 { |
158 if (getenv("DROPBEAR_DEBUG_NET_TIMESTAMP")) | 158 if (getenv("DROPBEAR_DEBUG_NET_TIMESTAMP")) |
159 { | 159 { |
160 /* Timestamps start from first network activity */ | 160 /* Timestamps start from first network activity */ |
161 struct timeval tv; | 161 struct timeval tv; |
162 gettimeofday(&tv, NULL); | 162 gettimeofday(&tv, NULL); |
163 debug_start_time = tv.tv_sec + (tv.tv_usec / 1000000.0); | 163 debug_start_time = tv.tv_sec + (tv.tv_usec / 1000000.0); |
164 TRACE(("Resetting Dropbear TRACE timestamps")) | 164 TRACE(("Resetting Dropbear TRACE timestamps")) |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 static double time_since_start() | 168 static double time_since_start() |
169 { | 169 { |
170 double nowf; | 170 double nowf; |
171 struct timeval tv; | 171 struct timeval tv; |
172 gettimeofday(&tv, NULL); | 172 gettimeofday(&tv, NULL); |
173 nowf = tv.tv_sec + (tv.tv_usec / 1000000.0); | 173 nowf = tv.tv_sec + (tv.tv_usec / 1000000.0); |
174 if (debug_start_time < 0) | 174 if (debug_start_time < 0) |
175 { | 175 { |
176 debug_start_time = nowf; | 176 debug_start_time = nowf; |
177 return 0; | 177 return 0; |
178 } | 178 } |
179 return nowf - debug_start_time; | 179 return nowf - debug_start_time; |
180 } | 180 } |
181 | 181 |
182 void dropbear_trace(const char* format, ...) { | 182 void dropbear_trace(const char* format, ...) { |
183 va_list param; | 183 va_list param; |
184 | 184 |