Xref: utzoo comp.unix.questions:24289 alt.sys.sun:1144 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!jarthur!bridge2!3comvax!tymix!cirrusl!sunstorm!dhesi From: dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) Newsgroups: comp.unix.questions,alt.sys.sun Subject: adjtime(2) hints needed Message-ID: <2119@cirrusl.UUCP> Date: 2 Aug 90 21:31:16 GMT Sender: news@cirrusl.UUCP Organization: Cirrus Logic Inc. Lines: 36 (Environment: SunOS 4.0.3 on Sun-3 and Sun-4 machines.) I am trying to use the adjtime(2) system call. I get the time-of-day from a remote host into a variable "struct timeval remote_time". I also call gettimeofday(2) to get the local time-of-day in the variable "struct timeval local_time". I must supply adjtime(2) with a delta time by which the local clock should be adjusted. So, I want to store this delta into "struct timeval delta_time". QUESTION: How should I use the values remote_time and local_time to calculate the values in delta_time? I am currently doing this: delta_time.tv_sec = remote_time.tv_sec - local_time.tv_sec; delta_time.tv_usec = remote_time.tv_usec - local_time.tv_usec; As a result, delta_time.tv_sec and delta_time.tv_usec could have different signs. Is this acceptable? If not, what should I be doing? The problem here is that I don't know how delta time is supposed to be represented in the two fields, and the manuals don't seem to address the issue. SECONDARY QUESTION: I am using the rtime(3) function (which may be SunOS-specific), to get time from a remote host. I need to supply rtime(3) the address of the remote host in a "struct sockaddr_in" structure. Am I supposed to place any specific value for a port number in the sin_port field of this structure? I find that rtime(3) seems to work correctly regardless of the value of sin_port, but it would be nice to know what the official intended usage is. I will appreciate any help anybody can provide. -- Rahul Dhesi UUCP: oliveb!cirrusl!dhesi