Return-Path: william@bourbon.usc.edu Delivery-Date: Mon Sep 22 10:50:59 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id m8MHox1a028366 for ; Mon, 22 Sep 2008 10:50:59 -0700 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id m8MHrP1c019841 for ; Mon, 22 Sep 2008 10:53:25 -0700 Message-Id: <200809221753.m8MHrP1c019841@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: About book keeping time Date: Mon, 22 Sep 2008 10:53:25 -0700 From: Bill Cheng Someone wrote: > To calculate the sleeping time for arrival thread we have to subtract > the book keeping time and make the arrival thread to sleep for only > that much amount of time. > I have used gettimeofday() function for it. Can gettimeofday() > function in this case return value in seconds also?. Right now I have > just considered the microseconds field in the timeval structure to > calclulate the book keeping time by substracting the two timestamps > (one when the customer object is created and other when it is put in > the queue) You need to fix your bugs and consider tv_sec. This is why I have suggested at the beginning that you need to keep track of time in both tv_sec and tv_usec and write utility functions to calculate time differences. -- Bill Cheng // bill.cheng@usc.edu