/************************************************************************
* retroLP solves linear programs using the simplex method.             *
* Copyright (C) 2001, 2003, 2005 Gavriel Yarmish & Richard Van Slyke.  *
* For further information, and gpl licensing, see the end of this file.*
************************************************************************/


// 3/8/05 long_clock.h 
// Declares LongClock class
// Typically, the system clock() measures only 
// to a little more than 1/2 hour, or a little 
// more than an hour depending on whether the 
// clock_t is taken to be signed or not. In
// any case it wraps around.Long_clock is designed
// to measure an interval indefinitely long interval
// as long as it is called before the sytem
// clock wraps around and or goes "negative."
// If this is not done the
// long_clock routine MAY return an error string.
// Otherwise it returns a string of the form:
// ..hhhh:mm:ss where ss is seonds, mm is minutes,
// and ...hhhh is hours. The timer is intitialized
// when it is instantiated (constructed), or it 
// can be reinitialized using resetLongClock.

// Prevent multiple inclusions of header file
#ifndef LONG_CLOCK_H 
#define LONG_CLOCK_H 

#include <time.h>

class LongClock
{
 public:
  LongClock(); // default constructor
  char * getInterval(); // returns ..hhhh:mm:ss
  char * getInterval(long); // Used with pivot clock
  bool reinitLongClock(); // Checks to see if clock()-clock0 too large
  long reinitLongClock(long); // For pivot clock
  void resetLongClock(); //reinitializes long_clock
  void resetLongClock(long); // For pivot clock
 private:
  unsigned long range; // Estimated maximum time in "tics" until clock() wraps.
  long tics;
  long hours, h;  // >= 0
  int minutes, m; // 0-59
  int seconds, s; // 0-59
  clock_t clock0;
  bool out_of_range;
  long tm; // A temporary variable
};

#endif

/************************************************************************
* retroLP solves linear programs using the simplex method.             *
* Copyright (C) 2001, 2003, 2005 Gavriel Yarmish & Richard Van Slyke.  *
*                                                                      *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or    *
* (at your option) any later version.                                  *
*                                                                      *
* 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.                         *
*                                                                      *
* You should have received a copy of the GNU General Public License    *  
* along with this program; if not, write to the Free Software          *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,           *
*                                                                      *
************************************************************************/
