summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/common/timer.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 7c83a9fc1..fe4eae142 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/12/14
+ * Added a precise and consistent tick() function for freebsd [ultramage]
* Wand of Hermode now dispells buffs only of allies.
* Fixed some null pointer checks in status_change_end.
* Corrected a crashy Warning message. [Skotlex]
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);