Permalink
Browse files

See the ChangeLog

  • Loading branch information...
1 parent 11d65c2 commit 6886fbf1f095ba02e15ddcd079036071ddda2ed1 rpj committed Jun 29, 2011
Showing with 25 additions and 12 deletions.
  1. +10 −0 ChangeLog
  2. +1 −1 global.c
  3. +2 −2 implement.h
  4. +1 −0 pthread.h
  5. +1 −1 pthread_getunique_np.c
  6. +5 −3 ptw32_relmillisecs.c
  7. +5 −5 ptw32_timespec.c
View
10 ChangeLog
@@ -1,3 +1,13 @@
+2011-06-29 Daniel Richard G. <skunk at iskunk dot org>
+
+ * ptw32_relmillisecs.c (ftime):
+ _ftime64_s() is only available in MSVC 2005 or later;
+ _ftime64() is available in MinGW or MSVC 2002 or later;
+ _ftime() is always available.
+ * pthread.h (long long): Not defined in older MSVC 6.
+ * implement.h (long long): Likewise.
+ * pthread_getunique_np.c (long long): Likewise.
+
2011-06-29 Ross Johnson <ross dot johnson at homemail dot com dot au>
* *.[ch] (PTW32_INTERLOCKED_*): These macros should now work for
View
2 global.c
@@ -55,7 +55,7 @@ int ptw32_features = 0;
/*
* Global [process wide] thread sequence Number
*/
-unsigned long long ptw32_threadSeqNumber = 0;
+unsigned __int64 ptw32_threadSeqNumber = 0;
/*
* Function pointer to QueueUserAPCEx if it exists, otherwise
View
4 implement.h
@@ -136,7 +136,7 @@ struct ptw32_thread_t_
#if defined(_UWIN)
DWORD dummy[5];
#endif
- UINT64 seqNumber; /* Process-unique thread sequence number */
+ unsigned __int64 seqNumber; /* Process-unique thread sequence number */
DWORD thread; /* Win32 thread ID */
HANDLE threadH; /* Win32 thread handle - POSIX thread is invalid if threadH == 0 */
pthread_t ptHandle; /* This thread's permanent pthread_t handle */
@@ -561,7 +561,7 @@ extern pthread_cond_t ptw32_cond_list_tail;
extern int ptw32_mutex_default_kind;
-extern unsigned long long ptw32_threadSeqNumber;
+extern unsigned __int64 ptw32_threadSeqNumber;
extern int ptw32_concurrency;
View
1 pthread.h
@@ -203,6 +203,7 @@
* VC++6.0 or early compiler's header has no DWORD_PTR type.
*/
typedef unsigned long DWORD_PTR;
+typedef unsigned long ULONG_PTR;
#endif
/*
* -----------------
View
2 pthread_getunique_np.c
@@ -40,7 +40,7 @@
/*
*
*/
-unsigned long long
+unsigned __int64
pthread_getunique_np (pthread_t thread)
{
return ((ptw32_thread_t*)thread.p)->seqNumber;
View
8 ptw32_relmillisecs.c
@@ -57,7 +57,8 @@ ptw32_relmillisecs (const struct timespec * abstime)
FILETIME ft;
SYSTEMTIME st;
#else /* ! NEED_FTIME */
-#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+#if ( defined(_MSC_VER) && _MSC_VER >= 1300 ) || \
+ ( (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601 )
struct __timeb64 currSysTime;
#else
struct _timeb currSysTime;
@@ -98,9 +99,10 @@ ptw32_relmillisecs (const struct timespec * abstime)
#else /* ! NEED_FTIME */
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && _MSC_VER >= 1400
_ftime64_s(&currSysTime);
-#elif (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+#elif ( defined(_MSC_VER) && _MSC_VER >= 1300 ) || \
+ ( (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601 )
_ftime64(&currSysTime);
#else
_ftime(&currSysTime);
View
10 ptw32_timespec.c
@@ -45,7 +45,7 @@
* time between jan 1, 1601 and jan 1, 1970 in units of 100 nanoseconds
*/
#define PTW32_TIMESPEC_TO_FILETIME_OFFSET \
- ( ((LONGLONG) 27111902 << 32) + (LONGLONG) 3577643008 )
+ ( ((int64_t) 27111902 << 32) + (int64_t) 3577643008 )
INLINE void
ptw32_timespec_to_filetime (const struct timespec *ts, FILETIME * ft)
@@ -58,7 +58,7 @@ ptw32_timespec_to_filetime (const struct timespec *ts, FILETIME * ft)
* -------------------------------------------------------------------
*/
{
- *(LONGLONG *) ft = ts->tv_sec * 10000000
+ *(int64_t *) ft = ts->tv_sec * 10000000
+ (ts->tv_nsec + 50) / 100 + PTW32_TIMESPEC_TO_FILETIME_OFFSET;
}
@@ -74,10 +74,10 @@ ptw32_filetime_to_timespec (const FILETIME * ft, struct timespec *ts)
*/
{
ts->tv_sec =
- (int) ((*(LONGLONG *) ft - PTW32_TIMESPEC_TO_FILETIME_OFFSET) / 10000000);
+ (int) ((*(int64_t *) ft - PTW32_TIMESPEC_TO_FILETIME_OFFSET) / 10000000);
ts->tv_nsec =
- (int) ((*(LONGLONG *) ft - PTW32_TIMESPEC_TO_FILETIME_OFFSET -
- ((LONGLONG) ts->tv_sec * (LONGLONG) 10000000)) * 100);
+ (int) ((*(int64_t *) ft - PTW32_TIMESPEC_TO_FILETIME_OFFSET -
+ ((int64_t) ts->tv_sec * (int64_t) 10000000)) * 100);
}
#endif /* NEED_FTIME */

0 comments on commit 6886fbf

Please sign in to comment.