uint64_t destime, oritime, rectime, tratime; int64_t result; result = ((rectime-oritime) + (tratime-destime))/2;
当((rectime-oritime) + (tratime-destime))是负数的时候,result不能得到正确的数,需要写成如下:
uint64_t destime, oritime, rectime, tratime; int64_t result, tmp; tmp = ((rectime-oritime) + (tratime-destime)); result = tmp/2;