aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluffypony <ric@spagni.net>2014-09-10 13:55:39 +0200
committerfluffypony <ric@spagni.net>2014-09-10 13:55:39 +0200
commita8d043b6dd58a15bb21448db8e141a76e5c8276e (patch)
tree1d8155c81a110d4b2f1b8c07e1da199ff6675f52
parentmake FreeBSD use -lcompat till we can fix ftime() (diff)
downloadmonero-a8d043b6dd58a15bb21448db8e141a76e5c8276e.tar.xz
replace ftime with gettimeofday on FreeBSD because lcompat is stupid
-rw-r--r--CMakeLists.txt4
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/crypto/oaes_lib.c28
3 files changed, 32 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea5a094f7..9614d7028 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,10 +130,6 @@ elseif(NOT MSVC)
set(Boost_LIBRARIES "${Boost_LIBRARIES};rt;pthread")
endif()
-if(FREEBSD)
- set(BSD_COMPAT "compat")
-endif()
-
set(COMMIT_ID_IN_VERSION ON CACHE BOOL "Include commit ID in version")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version")
if (NOT COMMIT_ID_IN_VERSION)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0bb3b87ea..e4e682b99 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -30,13 +30,13 @@ add_library(cryptonote_core ${CRYPTONOTE_CORE})
add_executable(daemon ${DAEMON} ${P2P} ${CRYPTONOTE_PROTOCOL})
add_executable(connectivity_tool ${CONN_TOOL})
add_executable(simpleminer ${MINER})
-target_link_libraries(daemon rpc cryptonote_core crypto common upnpc-static ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${BSD_COMPAT})
-target_link_libraries(connectivity_tool cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${BSD_COMPAT})
-target_link_libraries(simpleminer cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${BSD_COMPAT})
+target_link_libraries(daemon rpc cryptonote_core crypto common upnpc-static ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
+target_link_libraries(connectivity_tool cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
+target_link_libraries(simpleminer cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
add_library(rpc ${RPC})
add_library(wallet ${WALLET})
add_executable(simplewallet ${SIMPLEWALLET} )
-target_link_libraries(simplewallet wallet rpc cryptonote_core crypto common upnpc-static ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${BSD_COMPAT})
+target_link_libraries(simplewallet wallet rpc cryptonote_core crypto common upnpc-static ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
add_dependencies(daemon version)
add_dependencies(rpc version)
add_dependencies(simplewallet version)
diff --git a/src/crypto/oaes_lib.c b/src/crypto/oaes_lib.c
index 8e45309b5..ff2665381 100644
--- a/src/crypto/oaes_lib.c
+++ b/src/crypto/oaes_lib.c
@@ -468,6 +468,7 @@ OAES_RET oaes_sprintf(
#ifdef OAES_HAVE_ISAAC
static void oaes_get_seed( char buf[RANDSIZ + 1] )
{
+ #ifndef __FreeBSD__
struct timeb timer;
struct tm *gmTimer;
char * _test = NULL;
@@ -479,13 +480,27 @@ static void oaes_get_seed( char buf[RANDSIZ + 1] )
gmTimer->tm_year + 1900, gmTimer->tm_mon + 1, gmTimer->tm_mday,
gmTimer->tm_hour, gmTimer->tm_min, gmTimer->tm_sec, timer.millitm,
_test + timer.millitm, getpid() );
+ #else
+ struct timeval timer;
+ struct tm *gmTimer;
+ char * _test = NULL;
+ gettimeofday(&timer, NULL);
+ gmTimer = gmtime( &timer.tv_sec );
+ _test = (char *) calloc( sizeof( char ), timer.tv_usec/1000 );
+ sprintf( buf, "%04d%02d%02d%02d%02d%02d%03d%p%d",
+ gmTimer->tm_year + 1900, gmTimer->tm_mon + 1, gmTimer->tm_mday,
+ gmTimer->tm_hour, gmTimer->tm_min, gmTimer->tm_sec, timer.tv_usec/1000,
+ _test + timer.tv_usec/1000, getpid() );
+ #endif
+
if( _test )
free( _test );
}
#else
static uint32_t oaes_get_seed(void)
{
+ #ifndef __FreeBSD__
struct timeb timer;
struct tm *gmTimer;
char * _test = NULL;
@@ -497,6 +512,19 @@ static uint32_t oaes_get_seed(void)
_ret = gmTimer->tm_year + 1900 + gmTimer->tm_mon + 1 + gmTimer->tm_mday +
gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.millitm +
(uintptr_t) ( _test + timer.millitm ) + getpid();
+ #else
+ struct timeval timer;
+ struct tm *gmTimer;
+ char * _test = NULL;
+ uint32_t _ret = 0;
+
+ gettimeofday(&timer, NULL);
+ gmTimer = gmtime( &timer.tv_sec );
+ _test = (char *) calloc( sizeof( char ), timer.tv_usec/1000 );
+ _ret = gmTimer->tm_year + 1900 + gmTimer->tm_mon + 1 + gmTimer->tm_mday +
+ gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.tv_usec/1000 +
+ (uintptr_t) ( _test + timer.tv_usec/1000 ) + getpid();
+ #endif
if( _test )
free( _test );