CppTest home page | CppTest project page |
00001 // --- 00002 // 00003 // $Id: cpptest-time.h,v 1.2 2004/02/04 21:08:23 nilu Exp $ 00004 // 00005 // CppTest - A C++ Unit Testing Framework 00006 // Copyright (c) 2003 Niklas Lundell 00007 // 00008 // --- 00009 // 00010 // This library is free software; you can redistribute it and/or 00011 // modify it under the terms of the GNU Lesser General Public 00012 // License as published by the Free Software Foundation; either 00013 // version 2 of the License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the 00022 // Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00023 // Boston, MA 02111-1307, USA. 00024 // 00025 // --- 00026 00029 #ifndef CPPTEST_TIME_H 00030 #define CPPTEST_TIME_H 00031 00032 #include <iostream> 00033 #include <string> 00034 00035 namespace Test 00036 { 00043 class Time 00044 { 00045 public: 00046 Time(); 00047 Time(unsigned int sec, unsigned int usec); 00048 00049 unsigned int seconds() const; 00050 unsigned int microseconds() const; 00051 00052 static Time current(); 00053 00054 friend Time operator+(const Time& t1, const Time& t2); 00055 friend Time operator-(const Time& t1, const Time& t2); 00056 00057 friend std::ostream& operator<<(std::ostream& os, const Time& t); 00058 00059 private: 00060 unsigned int _sec; 00061 unsigned int _usec; 00062 }; 00063 00064 } // namespace Test 00065 00066 #endif // #ifndef CPPTEST_TIME_H