mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
Provide correct timeradd/timersup replacements
Bug caught and patch provided by Vektor. Fixes bug 4778.t
This commit is contained in:
parent
b5e6bbc01d
commit
da876aec63
7
changes/timersub_bug
Normal file
7
changes/timersub_bug
Normal file
@ -0,0 +1,7 @@
|
||||
o Major bugfixes:
|
||||
- Provide correct replacements for the timeradd() and timersub() functions
|
||||
for platforms that lack them (for example, windows). The timersub()
|
||||
function is used when expiring circuits, timeradd() is currently unused.
|
||||
Patch written by Vektor, who also reported the bug. Thanks! Bugfix
|
||||
on 0.2.2.24-alpha/0.2.3.1-alpha, fixes bug 4778.
|
||||
|
@ -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--; \
|
||||
|
Loading…
Reference in New Issue
Block a user