summaryrefslogtreecommitdiff
path: root/auto_tests/selfname_change_conference_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests/selfname_change_conference_test.c')
-rw-r--r--auto_tests/selfname_change_conference_test.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/auto_tests/selfname_change_conference_test.c b/auto_tests/selfname_change_conference_test.c
index 340f7aa6..2536b10e 100644
--- a/auto_tests/selfname_change_conference_test.c
+++ b/auto_tests/selfname_change_conference_test.c
@@ -21,12 +21,15 @@
21 * along with Tox. If not, see <http://www.gnu.org/licenses/>. 21 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
22 * 22 *
23 */ 23 */
24#define _XOPEN_SOURCE 500
24 25
25#include <stdio.h> 26#include <stdio.h>
26#include <stdlib.h> 27#include <stdlib.h>
27#include <string.h> 28#include <string.h>
28#include <time.h> 29#include <time.h>
29 30
31#include "helpers.h"
32
30#include "../toxcore/tox.h" 33#include "../toxcore/tox.h"
31#include "../toxencryptsave/toxencryptsave.h" 34#include "../toxencryptsave/toxencryptsave.h"
32 35
@@ -55,7 +58,6 @@ static void cbconfmembers(Tox *tox, uint32_t conference_number, uint32_t peer_nu
55int main(void) 58int main(void)
56{ 59{
57 uint32_t conference_number; 60 uint32_t conference_number;
58 struct timespec sleeptime;
59 struct Tox_Options to; 61 struct Tox_Options to;
60 Tox *t; 62 Tox *t;
61 TOX_ERR_CONFERENCE_NEW conference_err; 63 TOX_ERR_CONFERENCE_NEW conference_err;
@@ -73,11 +75,7 @@ int main(void)
73 } 75 }
74 76
75 tox_iterate(t, NULL); 77 tox_iterate(t, NULL);
76 78 c_sleep(tox_iteration_interval(t));
77 sleeptime.tv_sec = 0;
78 sleeptime.tv_nsec = tox_iteration_interval(t) * 1E6;
79
80 nanosleep(&sleeptime, NULL);
81 79
82 if (!tox_self_set_name(t, (const uint8_t *)newname, strlen(newname), &name_err)) { 80 if (!tox_self_set_name(t, (const uint8_t *)newname, strlen(newname), &name_err)) {
83 tox_kill(t); 81 tox_kill(t);
@@ -86,7 +84,7 @@ int main(void)
86 } 84 }
87 85
88 tox_iterate(t, NULL); 86 tox_iterate(t, NULL);
89 nanosleep(&sleeptime, NULL); 87 c_sleep(tox_iteration_interval(t));
90 tox_iterate(t, NULL); 88 tox_iterate(t, NULL);
91 89
92 fprintf(stderr, "error: name was not changed in callback. exiting.\n"); 90 fprintf(stderr, "error: name was not changed in callback. exiting.\n");