26#include <Safir/Utilities/Internal/VisibilityHelpers.h>
28#ifdef douf_time_cpp_EXPORTS
29# define DOUF_TIME_CPP_API SAFIR_HELPER_DLL_EXPORT
31# define DOUF_TIME_CPP_API SAFIR_HELPER_DLL_IMPORT
32# define SAFIR_LIBRARY_NAME "douf_time_cpp"
33# include <Safir/Utilities/Internal/AutoLink.h>
35#define DOUF_TIME_CPP_LOCAL SAFIR_HELPER_DLL_LOCAL
41 #pragma warning (push)
42 #pragma warning (disable : 4127)
45#include <boost/date_time/posix_time/posix_time.hpp>
46#include <boost/date_time/gregorian/greg_date.hpp>
47#include <boost/date_time/time_duration.hpp>
80 return ToPtime(utcTime + GetLocalTimeOffset());
92 boost::posix_time::time_duration duration = localTime - Epoch();
96 return seconds + fraction - GetLocalTimeOffset();
111 fraction = utcTime - sec;
113 long long hour = sec/3600;
114 long long minutes = (sec - hour*3600)/60;
115 long long seconds = sec - hour*3600 - minutes*60;
118 boost::posix_time::time_duration duration((
long)hour, (
long)minutes, (
long)seconds,
119 Dob::Typesystem::Int64(fraction * pow(10.0,boost::posix_time::time_duration::num_fractional_digits()) + 0.5));
121 return Epoch() + duration;
132 boost::posix_time::time_duration d = utcTime - Epoch();
133 return(
double)d.ticks() / d.ticks_per_second();
143 static inline boost::posix_time::ptime Epoch()
145 return boost::posix_time::ptime(boost::gregorian::date(1970,boost::date_time::Jan,1));
#define DOUF_TIME_CPP_API
Definition TimeProvider.h:31
This namespace contains all the functionality and definitions of the SAFIR SDK.
Definition Backdoor.h:31
DotsC_Int32 Int32
32 bit integer type.
Definition Defs.h:66
DotsC_Int64 Int64
64 bit integer type.
Definition Defs.h:69
DotsC_Float64 Float64
64 bit floating point type.
Definition Defs.h:75
Float64 Second
64 bit representation of Second.
Definition Defs.h:197
The Time class contains functions to operate on time.
Definition TimeProvider.h:62
static boost::posix_time::ptime ToPtime(const Safir::Dob::Typesystem::Si64::Second utcTime)
Get specified UTC time in boost::posix_time::ptime representation.
Definition TimeProvider.h:105
static Safir::Dob::Typesystem::Si64::Second ToUtcTime(const boost::posix_time::ptime &localTime)
Convert local time to UTC time.
Definition TimeProvider.h:90
static boost::posix_time::ptime ToLocalTime(const Safir::Dob::Typesystem::Si64::Second utcTime)
Convert from UTC to local time.
Definition TimeProvider.h:78
static Safir::Dob::Typesystem::Si64::Second ToDouble(const boost::posix_time::ptime &utcTime)
Convert specified UTC time to a Double.
Definition TimeProvider.h:130
static SAFIR_HELPER_DLL_IMPORT Safir::Dob::Typesystem::Si64::Second GetUtcTime()
Get current UTC time.