Common.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00027 //----------------------------------------------------------------------
00028 #ifndef ICL_CORE_THREAD_COMMON_H_INCLUDED
00029 #define ICL_CORE_THREAD_COMMON_H_INCLUDED
00030 
00031 #include "icl_core/TimeSpan.h"
00032 #include "icl_core/TimeStamp.h"
00033 
00034 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
00035 # include "icl_core/Deprecate.h"
00036 #endif
00037 
00038 namespace icl_core {
00042 namespace thread {
00044 namespace impl {
00045 
00046 inline TimeSpan getRelativeTimeout(const TimeStamp& timeout_absolute)
00047 {
00048   TimeStamp now = TimeStamp::now();
00049   if (timeout_absolute < now)
00050   {
00051     return TimeSpan();
00052   }
00053   else
00054   {
00055     return timeout_absolute - now;
00056   }
00057 }
00058 
00059 inline TimeStamp getAbsoluteTimeout(const TimeSpan& timeout_relative)
00060 {
00061   TimeStamp timeout_absolute = TimeStamp::now();
00062   if (timeout_relative < TimeSpan())
00063   {
00064     timeout_absolute += TimeSpan(365 * 86400, 0);
00065   }
00066   else
00067   {
00068     timeout_absolute += timeout_relative;
00069   }
00070   return timeout_absolute;
00071 }
00072 
00074 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
00075 
00076 inline TimeSpan GetRelativeTimeout(const TimeStamp& timeout_absolute) ICL_CORE_GCC_DEPRECATE_STYLE;
00077 ICL_CORE_VC_DEPRECATE_STYLE inline TimeSpan GetRelativeTimeout(const TimeStamp& timeout_absolute)
00078 { return getRelativeTimeout(timeout_absolute); }
00079 
00080 inline TimeStamp GetAbsoluteTimeout(const TimeSpan& timeout_relative) ICL_CORE_GCC_DEPRECATE_STYLE;
00081 ICL_CORE_VC_DEPRECATE_STYLE inline TimeStamp GetAbsoluteTimeout(const TimeSpan& timeout_relative)
00082 { return getAbsoluteTimeout(timeout_relative); }
00083 
00084 #endif
00085 
00086 
00087 }
00088 }
00089 }
00090 
00091 #endif


fzi_icl_core
Author(s):
autogenerated on Thu Jun 6 2019 20:22:23