diff options
author | Thomas Haller <thaller@redhat.com> | 2017-05-31 10:03:50 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-05-31 10:46:43 +0200 |
commit | 75f3c026ebe86628d2ea275d83df504186b38106 (patch) | |
tree | 5ba733cab6de38324622ffeccdea9d8092844d77 | |
parent | 5235b1740fd4c1ac412b56b805342900cde989f4 (diff) | |
download | NetworkManager-75f3c026ebe86628d2ea275d83df504186b38106.tar.gz |
shared/tests: expose end-time from NMTST_WAIT() macro
-rw-r--r-- | shared/nm-utils/nm-test-utils.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h index 5be8b8047b..66118fe9cf 100644 --- a/shared/nm-utils/nm-test-utils.h +++ b/shared/nm-utils/nm-test-utils.h @@ -138,12 +138,13 @@ #define NMTST_WAIT(max_wait_ms, wait) \ ({ \ gboolean _not_expired = TRUE; \ - gint64 _nmtst_end, _nmtst_max_wait_us = (max_wait_ms) * 1000L; \ + const gint64 nmtst_wait_start_us = g_get_monotonic_time (); \ + const gint64 nmtst_wait_duration_us = (max_wait_ms) * 1000L; \ + const gint64 nmtst_wait_end_us = nmtst_wait_start_us + nmtst_wait_duration_us; \ \ - _nmtst_end = g_get_monotonic_time () + _nmtst_max_wait_us; \ while (TRUE) { \ { wait }; \ - if (g_get_monotonic_time () > _nmtst_end) { \ + if (g_get_monotonic_time () > nmtst_wait_end_us) { \ _not_expired = FALSE; \ break; \ } \ |