editcap: ifix time shift with useconds carry

time shift to a whole number of seconds need to carry the seconds

Change-Id: I188d915bca8f86a2cc19fc603bf472f461e8beea
Reviewed-on: https://code.wireshark.org/review/28372
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Your Name 2018-06-22 14:45:59 +09:30 committed by Anders Broman
parent 590d0a483e
commit 7728a336ed
1 changed files with 3 additions and 3 deletions

View File

@ -1539,7 +1539,7 @@ main(int argc, char *argv[])
temp_rec = *rec;
temp_rec.ts.secs = previous_time.secs + strict_time_adj.tv.secs;
temp_rec.ts.nsecs = previous_time.nsecs;
if (temp_rec.ts.nsecs + strict_time_adj.tv.nsecs > ONE_BILLION) {
if (temp_rec.ts.nsecs + strict_time_adj.tv.nsecs >= ONE_BILLION) {
/* carry */
temp_rec.ts.secs++;
temp_rec.ts.nsecs += strict_time_adj.tv.nsecs - ONE_BILLION;
@ -1559,7 +1559,7 @@ main(int argc, char *argv[])
temp_rec = *rec;
temp_rec.ts.secs = previous_time.secs + strict_time_adj.tv.secs;
temp_rec.ts.nsecs = previous_time.nsecs;
if (temp_rec.ts.nsecs + strict_time_adj.tv.nsecs > ONE_BILLION) {
if (temp_rec.ts.nsecs + strict_time_adj.tv.nsecs >= ONE_BILLION) {
/* carry */
temp_rec.ts.secs++;
temp_rec.ts.nsecs += strict_time_adj.tv.nsecs - ONE_BILLION;
@ -1592,7 +1592,7 @@ main(int argc, char *argv[])
}
temp_rec.ts.nsecs -= time_adj.tv.nsecs;
} else { /* add */
if (temp_rec.ts.nsecs + time_adj.tv.nsecs > ONE_BILLION) {
if (temp_rec.ts.nsecs + time_adj.tv.nsecs >= ONE_BILLION) {
/* carry */
temp_rec.ts.secs++;
temp_rec.ts.nsecs += time_adj.tv.nsecs - ONE_BILLION;