[cs615asa] HW3-Time

Rob Richard rrichar1 at stevens.edu
Tue Apr 14 00:47:14 EDT 2009


I think you could just use the sleep system call to wait the given 
amount of time.


Chih-Yuan Lee wrote:
> Hi guys,
>
> I have some questions about "Time". 
>
> All my questions base on "how to get exactly time". I don't ask how to 
> get localtime.  
>
> About waiting time process, I have two ways to design the waiting time 
> process. But they have different drawbacks. Please give me some 
> suggestions.
>
> Suppose: Waiting: 6 seconds.
>                Localtime: start by 20th second.
>
> The first way: Count second by second
>
> It is because I count second by second. For this way, I need to count 
> six times. 
> For example,
>
> start by 20....
> 21.22.23.24.25.26  ..stop
>
> Drawback: 
> If the system is reallly really slow during the script running, 
> this way may miss one or two second. In fact, I have no chance to try 
> this way on a machine that is really really slow. So that's just what I 
> image.
>
> For example,
> start by 20....
> 21.22..{too slow and missing 23 } 24 25 26 27 ...stop
> The exactly time should be stopped by 26th second.  
>
> The second way: Intuition way
> It is because the waiting time is 6 seconds. So the other processes 
> will be started after 26th second (20+6).
>
> Drawback:
> If there is a  temporary failure happened at "26" second on the 
> machine, it may miss the first 26th second. And the other processes 
> will be started after the next 26th second.
>
> For exampe:
> start by 20.
> 21 22 23 24 25 {failure happened) 27 28 29 30.......0.1.2.....26(stop..)
>
> Does anyone have any good idea for this???
>
> Thanks,
> Chih-Yuan Lee
> _______________________________________________
> Cs615asa mailing list
> Cs615asa at lists.stevens.edu
> https://lists.stevens.edu/cgi-bin/mailman/listinfo/cs615asa
>   



More information about the Cs615asa mailing list