00001 #include "rtc/rtcMath.h"
00002
00003 #ifdef _WIN32
00004 #include <sys/timeb.h>
00005 #include <windows.h>
00006 #define M_PI 3.14159265358979323846
00007 #else
00008 #include <sys/time.h>
00009 #endif
00010
00011
00012
00013 namespace rtc{
00014 #ifdef _WIN32
00015 void rtc_seed_rand(void) {
00016 SYSTEMTIME SystemTime; GetSystemTime(&SystemTime);
00017 unsigned int n = int(SystemTime.wSecond*1000000 + SystemTime.wMilliseconds); std::srand(n);
00018 }
00019 #else
00020 void rtc_seed_rand(void) {
00021 timeval tv; gettimeofday(&tv,NULL);
00022 unsigned int n = int(tv.tv_sec*1000000 + tv.tv_usec); std::srand(n);
00023 }
00024 #endif
00025
00026 }