WSF
WsfDateTime.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFDATETIME_HPP
13#define WSFDATETIME_HPP
14
15#include "wsf_export.h"
16
17#include <string>
18
19#include "UtCalendar.hpp"
20class UtInput;
21
32
34{
35public:
36 WsfDateTime() = default;
37 WsfDateTime(const WsfDateTime&) = default;
38 ~WsfDateTime() = default;
39
40 bool ProcessInput(UtInput& aInput);
41
42 double GetJulianDate(int aYear, int aMonth, int aDay, double aSecondsPastMidnight) const;
43
44 double GetStartJulianDate() const;
45
46 void GetStartDate(int& aYear, int& aMonth, int& aDay) const;
47
48 void GetStartTime(int& aHour, int& aMinute, double& aSecond) const;
49
50 double GetStartTime() const;
51
52 const UtCalendar& GetStartDateAndTime() const;
53
54 bool SetStartDate(int aYear, int aMonth, int aDay);
55
56 bool SetStartTime(int aHour, int aMinute, double aSecond);
57
58 bool SetStartEpoch(double aEpoch);
59
61
62 bool UsingSystemTime() const;
63
64#undef GetCurrentTime // Avoid conflict with Windows macro
65 UtCalendar GetCurrentTime(double aSimTime) const;
66 void GetCurrentTime(double aSimTime, UtCalendar& aCurrentTime) const;
67
68protected:
70 WsfDateTime& operator=(const WsfDateTime& aRhs) = delete;
71
72private:
73 void ProcessStartDate(UtInput& aInput);
74 void ProcessStartTime(UtInput& aInput);
75 void ProcessStartEpoch(UtInput& aInput);
76 void ProcessStartTimeNow();
77
78 void TestDateTime();
79
80 bool mUsingSystemTime{false};
81 UtCalendar mDateTime;
82};
83
84#endif
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
bool SetStartEpoch(double aEpoch)
Set the start time as the Epoch (year*1000 + day "." fractional day).
Definition WsfDateTime.cpp:97
bool ProcessInput(UtInput &aInput)
Process simulation input commands 'start_date' and 'start_time'.
Definition WsfDateTime.cpp:123
double GetJulianDate(int aYear, int aMonth, int aDay, double aSecondsPastMidnight) const
Return the Julian date (i.e.: the number of days since 12:00:00 UTC on 1 January 4713 B....
Definition WsfDateTime.cpp:39
WsfDateTime(const WsfDateTime &)=default
bool UsingSystemTime() const
Return whether this object was initialized with system / wall clock time.
Definition WsfDateTime.cpp:208
const UtCalendar & GetStartDateAndTime() const
Get the start date and time of the simulation.
Definition WsfDateTime.cpp:68
bool SetStartDate(int aYear, int aMonth, int aDay)
Set the start date.
Definition WsfDateTime.cpp:88
bool SetStartTime(int aHour, int aMinute, double aSecond)
Set the start time as the number of hours, minutes and seconds past midnight of the start day.
Definition WsfDateTime.cpp:115
double GetStartJulianDate() const
Return the Julian date of the start date and time.
Definition WsfDateTime.cpp:26
UtCalendar GetCurrentTime(double aSimTime) const
Definition WsfDateTime.cpp:172
~WsfDateTime()=default
WsfDateTime & operator=(const WsfDateTime &aRhs)=delete
operator= declared but not defined to prevent use.
void GetStartTime(int &aHour, int &aMinute, double &aSecond) const
Get the start time as the number of hours, minutes and seconds past midnight of the start day.
Definition WsfDateTime.cpp:60
void GetStartDate(int &aYear, int &aMonth, int &aDay) const
Get the start date of the simulation.
Definition WsfDateTime.cpp:49
void SetCurrentDateAndTime()
Definition WsfDateTime.cpp:103
WsfDateTime()=default
Copyrights Multiple, All Rights Reserved