/*****************************************************************************/
/* File name: Timeval.java                                                   */
/* Purpose: to represent time - the timeval structure in NFS:                */
/*          the number of seconds and microseconds since midnight            */
/*          January 1, 1970, Greenwich Mean Time.                            */
/* Last modified: 24.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*                                                                           */
/* This program is distributed in the hope that it will be useful, but       */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General */
/* Public License for more details.                                          */
/*                                                                           */
/* This software is distributed under the terms                              */
/* of the GNU General Public License as published                            */
/* by the Free Software Foundation; either version 2, or (at your option)    */
/* any later version.                                                        */
/* See file COPYING for your rights (GNU GPL)                                */
/*****************************************************************************/

package nfs;


public
class

Timeval
{

  private final static String RCSID =
"$Header: /d/NFS/nfs/RCS/Timeval.java,v 1.1 1999/06/25 16:56:27 vklimov Exp $";

  long seconds;
  long useconds;


  public

  Timeval()
/*****************************************************************************/
/* Function name: Timeval                                                    */
/* File name: Timeval.java                                                   */
/* Purpose: constructor for the Timeval class                                */
/* Parameters:                                                               */
/* Returns:                                                                  */
/* Last modified: 24.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
                                                       /* Timeval */
/*---------------------------------------------------------------------------*/

    }
/*end of Timeval*/


  public

  Timeval( long seconds,
           long useconds )
/*****************************************************************************/
/* Function name: Timeval                                                    */
/* File name: Timeval.java                                                   */
/* Purpose: constructor for the Timeval class                                */
/* Parameters: seconds                                                       */
/*             useconds                                                      */
/* Returns:                                                                  */
/* Last modified: 24.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
                                                       /* Timeval */
/*---------------------------------------------------------------------------*/

      this.seconds  = seconds;
      this.useconds = useconds;

    }
/*end of Timeval*/


  public
  void

  putItselfIntoRPCMessage( rpc.Message rpcMessage )
/*****************************************************************************/
/* Function name: putItselfIntoRPCMessage                                    */
/* File name: Timeval.java                                                   */
/* Purpose: to put this Timeval object into a RPC message                    */
/* Parameters: rpcMessage                                                    */
/* Returns:                                                                  */
/* Last modified: 24.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
                                              /* putItselfIntoRPCMessage */
/*---------------------------------------------------------------------------*/

      rpcMessage.
        putUnsignedInteger( seconds );
      rpcMessage.
        putUnsignedInteger( useconds );

    }
/*end of putItselfIntoRPCMessage*/


  public
  boolean

  getItselfFromRPCMessage( rpc.Message rpcMessage )
/*****************************************************************************/
/* Function name: getItselfFromRPCMessage                                    */
/* File name: Timeval.java                                                   */
/* Purpose: to get this Timeval object from a RPC message                    */
/* Parameters: rpcMessage                                                    */
/* Returns: true - if got OK, false - otherwise                              */
/* Last modified: 24.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
                                              /* getItselfFromRPCMessage */
/*---------------------------------------------------------------------------*/

      seconds =
        rpcMessage.
          getUnsignedInteger();
      useconds =
        rpcMessage.
          getUnsignedInteger();

      return true;

    }
/*end of getItselfFromRPCMessage*/


  public
  String

  toString()
/*****************************************************************************/
/* Function name: toString                                                   */
/* File name: Timeval.java                                                   */
/* Purpose: to represent this Timeval object as a string                     */
/* Parameters:                                                               */
/* Returns: the string representation of the object                          */
/* Last modified: 24.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
      String result;
                                                       /* toString */
/*---------------------------------------------------------------------------*/

      result =
        "seconds=" + seconds + " useconds=" + useconds;

      return result;

    }
/*end of toString*/



} /* end of Timeval class */

/*****************************************************************************/
/* End of file: Timeval.java                                                 */
/*****************************************************************************/

