//Editor-Info: -*- C++ -*-
//
//Subject: OVOPS Library, class OTime
//
//File: otime.h
//
//Version: $Revision: 1.4 $
//
//Date: $Date: 1998/10/06 07:55:50 $
//
//Organisation:
//      Telecom Finland, 
//      Lappeenranta University of Technology
// 
//Author:
//      Panu Puro
//
//Description:
//      Includes the declaration of a time class and its
//      member functions.
//
//Copyright:
//      The following copyright and permission notice outlines the rights and
//      restrictions covering most parts of the core distribution of the OVOPS
//      System from Telecom Finland. Other parts have additional or different
//      copyrights and permissions; see the individual source files.
//      
//      Copyright 1994 by Telecom Finland
//      
//Licence:
//      Permission to use, copy, modify, distribute, and sell this software and
//      its documentation for any purpose is hereby granted without fee,
//      provided that the above copyright notice appear in all copies and that
//      both that copyright notice and this permission notice appear in
//      supporting documentation, and that the name of Telecom Finland not be
//      used in advertising or publicity pertaining to distribution of the
//      software without specific, written prior permission. Telecom Finland
//      makes no representations about the suitability of this software for any
//      purpose. It is provided "as is" without express or implied warranty.
//
//History:
//
// SF Revision:  1997/05/05  12:00:00  justus
// Added < operators.
//
// Revision 2.1  1994/10/07  12:44:00  asopanen
// Modifications required to use this file in util module.
//
// Revision 2.0  1994/07/07  10:16:35  pmp
// OVOPS Version 1.0
//

#ifndef OTIME_H
#define OTIME_H

#include <sys/time.h>

//
//Class: OTime
//
//Inherited: timeval
//
//Description:
//      This is a basic class that is supposed to hold a time value. 
//      OTime class is designed to be used in OVOPS's i/o handler 
//      that needs a time type that is capable to handle time in
//      micro seconds. Time is normalized all the time. This is done 
//      by the member functions. 
//
//Commentary:
//      This time class is designed to be used in the i/o handler. 
//      This is partly implemented because the system dependant
//      time structures are wanted to hide. 
//
class OTime : public timeval {
    public:
        OTime (void);
        explicit OTime (long seconds, long micros = 0);
        OTime (const OTime &other);

        OTime &operator = (const OTime &rhs);
        OTime &operator = (const double other);
        OTime operator - (const OTime &other) const;
        OTime operator + (const OTime &other) const;
        OTime operator + (const double other) const;
        int operator <= (const OTime &other) const;
        int operator >= (const OTime &other) const;
        int operator < (const OTime &other) const;
        int operator < (const double other) const;
        int operator > (const OTime &other) const;
        int operator > (const double other) const;
        int operator == (const OTime &other) const;
        int operator != (const OTime &other) const;
        int operator == (const double other) const;
        int operator != (const double other) const;

        long getSeconds (void) const;
        long getMicros (void) const;

    protected:
};

#endif // OTIME_H

