ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
time_stopper Class Reference

#include <time_stopper.h>

Public Member Functions

 time_stopper (double timelimit)
 
bool valid () const
 
bool operator() () const
 
boost::chrono::duration< double > time_left () const
 

Detailed Description

Definition at line 34 of file time_stopper.h.

Constructor & Destructor Documentation

time_stopper::time_stopper ( double  timelimit)

Definition at line 29 of file time_stopper.cpp.

30 : limit(timelimit)
31 , start(boost::chrono::high_resolution_clock::now())
32 { }

Member Function Documentation

bool time_stopper::operator() ( ) const

Definition at line 38 of file time_stopper.cpp.

38  {
39  return (limit.count() > 0 && boost::chrono::high_resolution_clock::now() > start + limit);
40 }
boost::chrono::duration< double > time_stopper::time_left ( ) const

Definition at line 42 of file time_stopper.cpp.

42  {
43  return (start + limit) - boost::chrono::high_resolution_clock::now();
44 }
bool time_stopper::valid ( ) const

Definition at line 34 of file time_stopper.cpp.

34  {
35  return limit.count();
36 }

The documentation for this class was generated from the following files: