summaryrefslogtreecommitdiff
path: root/sem_timedwait.c
diff options
context:
space:
mode:
authorrpj <rpj>2005-04-01 01:28:29 +0000
committerrpj <rpj>2005-04-01 01:28:29 +0000
commitf6f9976af7a520dd1aeced4f104f4d4711f28e23 (patch)
tree1a4e65f32d585c114af33772adfaa1995ffcf093 /sem_timedwait.c
parent25e5c566c5b050a04fc03851895f72750f016e4e (diff)
''
Diffstat (limited to 'sem_timedwait.c')
-rw-r--r--sem_timedwait.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sem_timedwait.c b/sem_timedwait.c
index 6bf94d4..7fba45f 100644
--- a/sem_timedwait.c
+++ b/sem_timedwait.c
@@ -121,11 +121,11 @@ sem_timedwait (sem_t * sem, const struct timespec *abstime)
#endif /* NEED_FTIME */
- const DWORD NANOSEC_PER_MILLISEC = 1000000;
- const DWORD MILLISEC_PER_SEC = 1000;
+ const int64_t NANOSEC_PER_MILLISEC = 1000000;
+ const int64_t MILLISEC_PER_SEC = 1000;
DWORD milliseconds;
- DWORD tmpAbsMilliseconds;
- DWORD tmpCurrMilliseconds;
+ int64_t tmpAbsMilliseconds;
+ int64_t tmpCurrMilliseconds;
if (sem == NULL)
{
@@ -150,8 +150,8 @@ sem_timedwait (sem_t * sem, const struct timespec *abstime)
*
* Assume all integers are unsigned, i.e. cannot test if less than 0.
*/
- tmpAbsMilliseconds = abstime->tv_sec * MILLISEC_PER_SEC;
- tmpAbsMilliseconds += (abstime->tv_nsec + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC;
+ tmpAbsMilliseconds = (int64_t)abstime->tv_sec * MILLISEC_PER_SEC;
+ tmpAbsMilliseconds += ((int64_t)abstime->tv_nsec + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC;
/* get current system time */
@@ -171,21 +171,21 @@ sem_timedwait (sem_t * sem, const struct timespec *abstime)
ptw32_filetime_to_timespec(&ft, &currSysTime);
}
- tmpCurrMilliseconds = currSysTime.tv_sec * MILLISEC_PER_SEC;
- tmpCurrMilliseconds += (currSysTime.tv_nsec + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC;
+ tmpCurrMilliseconds = (int64_t)currSysTime.tv_sec * MILLISEC_PER_SEC;
+ tmpCurrMilliseconds += ((int64_t)currSysTime.tv_nsec + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC;
#else /* ! NEED_FTIME */
_ftime(&currSysTime);
- tmpCurrMilliseconds = (DWORD) currSysTime.time * MILLISEC_PER_SEC;
- tmpCurrMilliseconds += (DWORD) currSysTime.millitm;
+ tmpCurrMilliseconds = (int64_t) currSysTime.time * MILLISEC_PER_SEC;
+ tmpCurrMilliseconds += (int64_t) currSysTime.millitm;
#endif /* NEED_FTIME */
if (tmpAbsMilliseconds > tmpCurrMilliseconds)
{
- milliseconds = tmpAbsMilliseconds - tmpCurrMilliseconds;
+ milliseconds = (DWORD) (tmpAbsMilliseconds - tmpCurrMilliseconds);
if (milliseconds == INFINITE)
{
/* Timeouts must be finite */