Safir SDK Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TimeProvider.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * Copyright Saab AB, 2006-2013 (http://safir.sourceforge.net)
4 *
5 * Created by: Erik Adolfsson / sterad
6 *
7 *******************************************************************************
8 *
9 * This file is part of Safir SDK Core.
10 *
11 * Safir SDK Core is free software: you can redistribute it and/or modify
12 * it under the terms of version 3 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * Safir SDK Core is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Safir SDK Core. If not, see <http://www.gnu.org/licenses/>.
22 *
23 ******************************************************************************/
24 #ifndef __DOUF_TIME_H
25 #define __DOUF_TIME_H
26 
28 
29 //disable warnings in boost
30 #if defined _MSC_VER
31  #pragma warning (push)
32  #pragma warning (disable : 4127)
33 #endif
34 
35 #include <boost/date_time/posix_time/posix_time.hpp>
36 
37 //and enable the warnings again
38 #if defined _MSC_VER
39  #pragma warning (pop)
40 #endif
41 
42 #if defined _MSC_VER
43 # ifdef DOUF_TIME_CPP_EXPORTS
44 # define DOUF_TIME_CPP_API __declspec(dllexport)
45 # else
46 # define DOUF_TIME_CPP_API __declspec(dllimport)
47 # ifdef NDEBUG
48 # pragma comment( lib, "douf_time_cpp.lib" )
49 # else
50 # pragma comment( lib, "douf_time_cppd.lib" )
51 # endif
52 # endif
53 #elif defined __GNUC__
54 # define DOUF_TIME_CPP_API
55 #endif
56 
57 namespace Safir
58 {
59 namespace Time
60 {
61 
65  class DOUF_TIME_CPP_API TimeProvider
66  {
67  public:
68 
74  static Safir::Dob::Typesystem::Si64::Second GetUtcTime();
75 
82  static boost::posix_time::ptime ToLocalTime(const Safir::Dob::Typesystem::Si64::Second utcTime);
83 
90  static Safir::Dob::Typesystem::Si64::Second ToUtcTime(const boost::posix_time::ptime & localTime);
91 
98  static boost::posix_time::ptime ToPtime(const Safir::Dob::Typesystem::Si64::Second utcTime);
99 
106  static Safir::Dob::Typesystem::Si64::Second ToDouble(const boost::posix_time::ptime & utcTime);
107  };
108 
109 }; // namespace Time
110 }; // namespace Safir
111 
112 #endif //__DOUF_TIME_H
Float64 Second
64 bit representation of Second.
Definition: Dob/Typesystem/Defs.h:200
The Time class contains functions to operate on time.
Definition: TimeProvider.h:65