dtynan@zorba.Tynan.COM (Dermot Tynan) (03/21/89)
I tried to post this message but it didn't appear on any of the board. So i'm trying once again : [Slight problem in transition - hopefully solved now - Der] Hello, **** Excellent Question For Unix Kernel Wizards/Gurus/Hackers***** I am trying for porting a RPC package (developed for BSD 4.2 Unix) to the System V Rel 3.0 on AT&T's 3B2/400 box: I am stuck up with an equivalent code for the Gettimeofday() of BSD. I have tried with getting time() and assigning micro seconds to 0. However, this is creating lot of problems to me : especially when the RPC server is System V and client is BSD repectively (and vice versa). This is due to BSD using timeouts in milliseconds where as SysV using seconds. One might suggest using times() call which gives 16msec precision. But that is CPU usage time of the process not the time of the day. Essentially my problem is: is there a way for a user level process to access the time of the day in milli seonds. Any working solutions are welcome. If some body could send me (e-mail) alogorithm/code, it would be of very much help and I would greatly appreciate. Thanks much, Murthy. ps: there is another use for gettimeofday() : good source of randomizer (use microseconds part of the timeval, discard last byte and you get a reasonably good random number over time).
stevens@hsi.com (Richard Stevens) (03/23/89)
The times(2) system call *does* return the elapsed time in clock ticks, as the return value of the function. Richard Stevens Health Systems International, New Haven, CT stevens@hsi.com ... { uunet | yale } ! hsi ! stevens