diff options
author | Sebastian Hahn <sebastian@torproject.org> | 2011-12-25 23:19:08 +0100 |
---|---|---|
committer | Sebastian Hahn <sebastian@torproject.org> | 2011-12-25 23:19:08 +0100 |
commit | da876aec63b133b64eb6e71f8b87df5c84e7ec3b (patch) | |
tree | ad83831470b0818c1fa19b8cc0c8b298235e0393 /src | |
parent | b5e6bbc01dc5d89285aba8a1440a2f5833e531a5 (diff) | |
download | tor-da876aec63b133b64eb6e71f8b87df5c84e7ec3b.tar tor-da876aec63b133b64eb6e71f8b87df5c84e7ec3b.tar.gz |
Provide correct timeradd/timersup replacements
Bug caught and patch provided by Vektor. Fixes bug 4778.t
Diffstat (limited to 'src')
-rw-r--r-- | src/common/compat.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/compat.h b/src/common/compat.h index 3e1b5b826..e0b074cf5 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -334,7 +334,7 @@ struct tm *tor_gmtime_r(const time_t *timep, struct tm *result); #define timeradd(tv1,tv2,tvout) \ do { \ (tvout)->tv_sec = (tv1)->tv_sec + (tv2)->tv_sec; \ - (tvout)->tv_usec = (tv2)->tv_usec + (tv2)->tv_usec; \ + (tvout)->tv_usec = (tv1)->tv_usec + (tv2)->tv_usec; \ if ((tvout)->tv_usec >= 1000000) { \ (tvout)->tv_usec -= 1000000; \ (tvout)->tv_sec++; \ @@ -348,7 +348,7 @@ struct tm *tor_gmtime_r(const time_t *timep, struct tm *result); #define timersub(tv1,tv2,tvout) \ do { \ (tvout)->tv_sec = (tv1)->tv_sec - (tv2)->tv_sec; \ - (tvout)->tv_usec = (tv2)->tv_usec - (tv2)->tv_usec; \ + (tvout)->tv_usec = (tv1)->tv_usec - (tv2)->tv_usec; \ if ((tvout)->tv_usec < 0) { \ (tvout)->tv_usec += 1000000; \ (tvout)->tv_sec--; \ |