diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-12-14 10:52:51 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-12-14 10:52:51 +0000 |
commit | 2f8b825e21566947c429913622dfa934476e3913 (patch) | |
tree | d0ba1f918363679ca5c3579a04a5c9372b7513cb /src | |
parent | aeabd9b6ae7cd6b59d6c8d85609559f132a464ee (diff) | |
download | hercules-2f8b825e21566947c429913622dfa934476e3913.tar.gz hercules-2f8b825e21566947c429913622dfa934476e3913.tar.bz2 hercules-2f8b825e21566947c429913622dfa934476e3913.tar.xz hercules-2f8b825e21566947c429913622dfa934476e3913.zip |
Added a precise and consistent tick() function for freebsd (see bugreport:240)
(TODO: apply it to multiple platforms using an appropriate configure script)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11912 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/common/timer.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/common/timer.c b/src/common/timer.c index 5f1f17e2f..c66fd5960 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -91,8 +91,12 @@ char* search_timer_func_list(TimerFunc func) /// platform-abstracted tick retrieval static unsigned int tick(void) { -#ifdef WIN32 +#if defined(WIN32) return GetTickCount(); +#elif defined(__FREEBSD__) + struct timespec tval; + clock_gettime(CLOCK_MONOTONIC, &tval); + return tval.tv_sec * 1000 + tval.tv_nsec / 1000000; #else struct timeval tval; gettimeofday(&tval, NULL); |