diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-02-02 10:23:59 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-02-02 10:23:59 +0000 |
commit | e3498cf0825e1ca9f5cbad0cee4cdb090964baf2 (patch) | |
tree | 3976b9d724e53f8281cbe2ce68180209ba883e5a /os/common/ports | |
parent | 69aa39ff927e44c72f7f4824ee47934660c5055c (diff) | |
download | ChibiOS-e3498cf0825e1ca9f5cbad0cee4cdb090964baf2.tar.gz ChibiOS-e3498cf0825e1ca9f5cbad0cee4cdb090964baf2.tar.bz2 ChibiOS-e3498cf0825e1ca9f5cbad0cee4cdb090964baf2.zip |
Posix simulator, still work in progress.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10077 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/common/ports')
-rw-r--r-- | os/common/ports/SIMIA32/chcore.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/os/common/ports/SIMIA32/chcore.c b/os/common/ports/SIMIA32/chcore.c index 73e91fa0a..83a1574a9 100644 --- a/os/common/ports/SIMIA32/chcore.c +++ b/os/common/ports/SIMIA32/chcore.c @@ -25,7 +25,11 @@ * @{
*/
+#if defined(WIN32)
#include <windows.h>
+#else
+#include <sys/time.h>
+#endif
#include "ch.h"
@@ -110,11 +114,18 @@ void _port_thread_start(msg_t (*pf)(void *), void *p) { * @return The realtime counter value.
*/
rtcnt_t port_rt_get_counter_value(void) {
+#if defined(WIN32)
LARGE_INTEGER n;
QueryPerformanceCounter(&n);
return (rtcnt_t)(n.QuadPart / 1000LL);
+#else
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ return ((rtcnt_t)tv.tv_sec * (rtcnt_t)1000000) + (rtcnt_t)tv.tv_usec;
+#endif
}
/** @} */
|