mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Remove timer test, fix CMake files to respect this change
This commit is contained in:
parent
747c290269
commit
4ade191677
|
@ -9,7 +9,6 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testclient.cmake)
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testserver.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testserver.cmake)
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Messenger_test.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Messenger_test.cmake)
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/crypto_speed_test.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/crypto_speed_test.cmake)
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/timer_test.cmake)
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/nTox_win32.cmake)
|
# include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/nTox_win32.cmake)
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
project(timer_test C)
|
|
||||||
|
|
||||||
set(exe_name timer_test)
|
|
||||||
|
|
||||||
add_executable(${exe_name}
|
|
||||||
timer_test.c)
|
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
|
|
@ -1,68 +0,0 @@
|
||||||
#include "../core/timer.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void mssleep(int ms)
|
|
||||||
{
|
|
||||||
#ifdef WINDOWS
|
|
||||||
Sleep(ms);
|
|
||||||
#else
|
|
||||||
usleep(ms * 1000);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int callback(timer *t, void *arg)
|
|
||||||
{
|
|
||||||
printf("%s\n", (char *)arg);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int repeating(timer *t, void *arg)
|
|
||||||
{
|
|
||||||
printf("%s\n", (char *)arg);
|
|
||||||
timer_start(t, 3);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void timer_debug_print();
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
timer_init();
|
|
||||||
timer_debug_print();
|
|
||||||
|
|
||||||
timer *t = new_timer();
|
|
||||||
timer_setup(t, &callback, "Long setup method, 4 seconds");
|
|
||||||
timer_start(t, 4);
|
|
||||||
timer_debug_print();
|
|
||||||
|
|
||||||
timer_single(&repeating, (void *)"This repeats every 3 seconds", 3);
|
|
||||||
timer_debug_print();
|
|
||||||
|
|
||||||
timer_single(&callback, "Short method, 4 seconds", 4);
|
|
||||||
timer_debug_print();
|
|
||||||
|
|
||||||
timer_single(&callback, "1 second", 1);
|
|
||||||
timer_debug_print();
|
|
||||||
|
|
||||||
timer_single(&callback, "15 seconds", 15);
|
|
||||||
timer_debug_print();
|
|
||||||
|
|
||||||
timer_single(&callback, "10 seconds", 10);
|
|
||||||
timer_debug_print();
|
|
||||||
|
|
||||||
timer_us(&callback, "100000us", 100000);
|
|
||||||
timer_us(&callback, "13s", 13 * US_PER_SECOND);
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
timer_poll();
|
|
||||||
mssleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user