TimeStamp.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *   http://www.apache.org/licenses/LICENSE-2.0
00009 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016  
00017 
00018 #ifndef _TimeStamp_H
00019 #define _TimeStamp_H
00020 
00021 #include <time.h>
00022 #include <cob_utilities/StrUtil.h>
00023 
00024 //-------------------------------------------------------------------
00025 
00031 class TimeStamp
00032 {
00033         public:
00035                 TimeStamp();
00036 
00038                 virtual ~TimeStamp() {};
00039 
00041                 void SetNow();
00042 
00044                 double operator- ( const TimeStamp& EarlierTime ) const;
00045 
00047 
00049                 void operator+= ( double TimeS );
00050 
00052 
00054                 void operator-= ( double TimeS );
00055 
00057                 bool operator> ( const TimeStamp& Time );
00058 
00060                 bool operator< ( const TimeStamp& Time );
00061 
00065                 void getTimeStamp ( long& lSeconds, long& lNanoSeconds );
00066 
00070                 void setTimeStamp ( const long& lSeconds, const long& lNanoSeconds );
00071 
00076                 std::string CurrentToString();
00077 
00078                 std::string ToString();
00079 
00080         protected:
00081 
00083                 timespec m_TimeStamp;
00084 
00085         private:
00086 
00088                 static double TimespecToDouble ( const ::timespec& LargeInt );
00089 
00091                 static ::timespec DoubleToTimespec ( double TimeS );
00092 
00093 };
00094 
00095 
00096 #endif
00097 


cob_utilities
Author(s): Christian Connette
autogenerated on Sat Jun 8 2019 21:02:25