Skip to content

Commit 3fa0dde

Browse files
committed
chg: dev: cleanup timeval bits !wip
Signed-off-by: Stephen L Arnold <sarnold@vctlabs.com>
1 parent d6aadbc commit 3fa0dde

5 files changed

Lines changed: 14 additions & 35 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,13 @@ if(WIN32)
209209
)
210210
endif()
211211
endif()
212+
213+
# set(TVAL_INCLUDES inc/sys_time_h)
214+
# include_directories(${TVAL_INCLUDES})
215+
# if(ABC_USE_NAMESPACE)
216+
# set_source_files_properties(${TVAL_INCLUDES}/sys/time.h PROPERTIES LANGUAGE CXX)
217+
# endif()
218+
212219
target_compile_definitions(abc_interface
213220
INTERFACE
214221
$<$<BOOL:${ABC_USE_NO_PTHREADS}>:HAVE_STRUCT_TIMESPEC>

src/opt/ufar/UfarCmd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Author: Yen-Sheng Ho
66
*/
77

8-
#ifdef _WIN32
8+
#if defined(_WIN32) && !defined(__MINGW32__)
99
#include <windows.h>
1010
#else
1111
#include <sys/time.h>
@@ -166,7 +166,7 @@ static int Abc_CommandProveUsingUif( Abc_Frame_t * pAbc, int argc, char ** argv
166166
if(!opt_mgr.Parse(argc, argv)) {
167167
opt_mgr.PrintUsage();
168168
cout << "\n This command was developed by Yen-Sheng Ho at UC Berkeley in 2015.\n";
169-
cout << " https://people.eecs.berkeley.edu/~alanmi/publications/2016/fmcad16_uif.pdf \n";
169+
cout << " https://people.eecs.berkeley.edu/~alanmi/publications/2016/fmcad16_uif.pdf \n";
170170
return 0;
171171
}
172172

src/opt/ufar/UfarMgr.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
#include <regex>
1616
#include <queue>
1717

18-
#ifdef _WIN32
18+
#if defined(_WIN32) && !defined(__MINGW32__)
1919
#include <windows.h>
20+
#else
21+
#include <sys/time.h>
2022
#endif
2123

2224
#include <base/wlc/wlc.h>
@@ -530,7 +532,7 @@ void SimUifPairFinder::AddPair(const UIF_PAIR& x) {
530532

531533
if(x.fMark)
532534
_mat_pairwise_matches[x.second.idx][x.first.idx] += nThreshold;
533-
else
535+
else
534536
_mat_pairwise_matches[x.first.idx][x.second.idx] += nThreshold;
535537
}
536538
int SimUifPairFinder::GetCount(const UIF_PAIR& x) const {

src/opt/ufar/UfarMgr.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,8 @@
1515
#include <sstream>
1616
#include <iostream>
1717
#include <memory>
18+
1819
#if defined(_WIN32) && !defined(__MINGW32__)
19-
// Define timeval before windows.h to prevent winsock.h forward declaration conflicts
20-
#ifndef _TIMEVAL_DEFINED
21-
#define _TIMEVAL_DEFINED
22-
struct timeval {
23-
long tv_sec;
24-
long tv_usec;
25-
};
26-
#endif
2720
#include <windows.h>
2821
#else
2922
#include <sys/time.h>

src/opt/util/util.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,7 @@
1717
#include <vector>
1818

1919
#if defined(_WIN32) && !defined(__MINGW32__)
20-
// Define timeval before windows.h to prevent winsock.h forward declaration conflicts
21-
#ifndef _TIMEVAL_DEFINED
22-
#define _TIMEVAL_DEFINED
23-
struct timeval {
24-
long tv_sec;
25-
long tv_usec;
26-
};
27-
#endif
2820
#include <windows.h>
29-
30-
static inline int gettimeofday(struct timeval *tv, struct timezone *tz) {
31-
if (tv) {
32-
FILETIME ft;
33-
GetSystemTimeAsFileTime(&ft);
34-
ULARGE_INTEGER uli;
35-
uli.LowPart = ft.dwLowDateTime;
36-
uli.HighPart = ft.dwHighDateTime;
37-
ULONGLONG time_in_us = (uli.QuadPart - 116444736000000000ULL) / 10ULL;
38-
tv->tv_sec = (long)(time_in_us / 1000000ULL);
39-
tv->tv_usec = (long)(time_in_us % 1000000ULL);
40-
}
41-
(void)tz;
42-
return 0;
43-
}
4421
#else
4522
#include <sys/time.h>
4623
#endif

0 commit comments

Comments
 (0)