From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1135 invoked by alias); 10 Jun 2005 20:23:52 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 1060 invoked by uid 22791); 10 Jun 2005 20:23:36 -0000 Received: from smtp811.mail.ukl.yahoo.com (HELO smtp811.mail.ukl.yahoo.com) (217.12.12.201) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Fri, 10 Jun 2005 20:23:36 +0000 Received: (qmail 97009 invoked from network); 10 Jun 2005 20:23:34 -0000 Received: from unknown (HELO ?192.168.2.7?) (s.croall@btinternet.com@217.43.204.148 with plain) by smtp811.mail.ukl.yahoo.com with SMTP; 10 Jun 2005 20:23:34 -0000 Message-ID: <42A9F6CB.9070304@btinternet.com> Date: Fri, 10 Jun 2005 20:23:00 -0000 From: "Steve Croall (TIBCO)" Reply-To: scroall@tibco.com User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) MIME-Version: 1.0 To: Allan Comar CC: pthreads-win32@sources.redhat.com Subject: Re: pthread_cond_timedwait References: <9F29CF63398CDA4E8F98170E30D4230727C1D7@cs01i00388.commodity.com.br> In-Reply-To: <9F29CF63398CDA4E8F98170E30D4230727C1D7@cs01i00388.commodity.com.br> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005/txt/msg00110.txt.bz2 Hi, The timeout parameter you pass to pthread_cond_timedwait() is a struct timespec type, which is defined in pthread.h, if HAVE_STRUCT_TIMESPEC is not defined at build time. struct timespec { long tv_sec; long tv_nsec; }; Just set the tv_nsec to the amount of nanoseconds required. The pthread source on Windows uses the following calculation to convert the above structure to milliseconds: tmpAbsMilliseconds = (int64_t)abstime->tv_sec * MILLISEC_PER_SEC; tmpAbsMilliseconds += ((int64_t)abstime->tv_nsec + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC; Using the following defines: const int64_t NANOSEC_PER_MILLISEC = 1000000; const int64_t MILLISEC_PER_SEC = 1000; Steve. Allan Comar wrote: > Hi all, I am needing something that I couldn't find in nowhere else, I am trying to use pthread_cond_timedwait but I want that the time that I need to wait is setted im milliseconds, I already could do in seconds and i am having a real hard time trying it in milliseconds. Any Ideas ? I am using MSVC6.0 with pthreads. > -- J. Senior Software Engineer, Tibco Software Ltd. T. +44 (0) 1792 360773 M. +44 (0) 7788 971394 E. scroall@tibco.com W. www.tibco.com