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 #ifdef __LINUX__
00022 #include <time.h>
00023 #else
00024 #include <windows.h>
00025 #ifdef _DEBUG
00026 //#define new DEBUG_NEW
00027 #undef THIS_FILE
00028 static char THIS_FILE[] = __FILE__;
00029 #endif
00030 namespace RTB
00031 {
00032 
00033 #endif
00034 
00035 //-------------------------------------------------------------------
00036 
00042 class TimeStamp
00043 {
00044 public:
00046   TimeStamp();
00047 
00049   virtual ~TimeStamp(){};
00050 
00052   void SetNow();
00053 
00055   double operator-(const TimeStamp& EarlierTime) const;
00056 
00058 
00060   void operator+=(double TimeS);
00061 
00063 
00065   void operator-=(double TimeS);
00066 
00068   bool operator>(const TimeStamp& Time);
00069 
00071   bool operator<(const TimeStamp& Time);
00072 
00076   void getTimeStamp(long& lSeconds, long& lNanoSeconds);
00077 
00081   void setTimeStamp(const long& lSeconds, const long& lNanoSeconds);
00082 
00083 protected:
00085 #ifdef __LINUX__
00086   timespec m_TimeStamp;
00087 #else
00088   LARGE_INTEGER m_TimeStamp;
00089 #endif
00090 
00091 private:
00093 #ifdef __LINUX__
00094   static double TimespecToDouble(const ::timespec& LargeInt);
00095 
00097   static ::timespec DoubleToTimespec(double TimeS);
00098 #else
00099   static double LargeIntToDouble(const LARGE_INTEGER& LargeInt);
00100 
00102   static LARGE_INTEGER DoubleToLargeInt(double TimeS);
00103 
00105   static double m_DwordSize;
00106 
00108   static double m_SecPerCount;
00109 #endif
00110 };
00111 
00112 #ifdef __LINUX__
00113 #else
00114 }  // namespace
00115 #endif
00116 #endif


schunk_powercube_chain
Author(s): Florian Weisshardt
autogenerated on Sat Jun 8 2019 20:25:18