BSD Porting fixes, conditional compilation and use of gettimeofday()

This commit is contained in:
David Pello
2016-05-14 20:30:19 +02:00
committed by wmayer
parent b5dfc41759
commit 5f0073b9e0
8 changed files with 43 additions and 9 deletions

View File

@@ -57,10 +57,13 @@ TimeInfo::~TimeInfo()
void TimeInfo::setCurrent(void)
{
#if defined (_MSC_VER)
#if defined (FC_OS_WIN32)
_ftime( &timebuffer );
#elif defined(__GNUC__)
ftime( &timebuffer );
#else
struct timeval t;
gettimeofday(&t, NULL);
timebuffer.time = t.tv_sec;
timebuffer.millitm = t.tv_usec / 1000;
#endif
}

View File

@@ -28,13 +28,25 @@
#include <stdio.h>
#if defined(FC_OS_WIN32)
#include <sys/timeb.h>
#else
#include <sys/time.h>
#endif
#include <time.h>
#ifdef __GNUC__
# include <stdint.h>
#endif
#if !defined(FC_OS_WIN32)
struct timeb
{
int64_t time;
unsigned short millitm;
};
#endif
namespace Base
{
/// BaseClass class and root of the type system