WSF
WsfDateTime Class Reference

A singleton object used to maintain the start date and time of the simulation. More...

#include <WsfDateTime.hpp>

Public Member Functions

 WsfDateTime ()=default
 WsfDateTime (const WsfDateTime &)=default
 ~WsfDateTime ()=default
bool ProcessInput (UtInput &aInput)
 Process simulation input commands 'start_date' and 'start_time'.
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.C.).
double GetStartJulianDate () const
 Return the Julian date of the start date and time.
void GetStartDate (int &aYear, int &aMonth, int &aDay) const
 Get the start date of the simulation.
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.
double GetStartTime () const
 Get the time as the number of seconds past midnight of the start day.
const UtCalendar & GetStartDateAndTime () const
 Get the start date and time of the simulation.
bool SetStartDate (int aYear, int aMonth, int aDay)
 Set the start date.
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.
bool SetStartEpoch (double aEpoch)
 Set the start time as the Epoch (year*1000 + day "." fractional day).
void SetCurrentDateAndTime ()
bool UsingSystemTime () const
 Return whether this object was initialized with system / wall clock time.
UtCalendar GetCurrentTime (double aSimTime) const
void GetCurrentTime (double aSimTime, UtCalendar &aCurrentTime) const

Protected Member Functions

WsfDateTimeoperator= (const WsfDateTime &aRhs)=delete
 operator= declared but not defined to prevent use.

Detailed Description

A singleton object used to maintain the start date and time of the simulation.

Year, month and day values are subject to the following constraints:

  • Year must be specified as 4 digits (1999, 2000, etc).
  • Month must be in the range [1..12]
  • Days must be in the range [1..31] (modified appropriately for those months that don't have 31 days.

Constructor & Destructor Documentation

◆ WsfDateTime() [1/2]

WsfDateTime::WsfDateTime ( )
default

Referenced by operator=(), and WsfDateTime().

◆ WsfDateTime() [2/2]

WsfDateTime::WsfDateTime ( const WsfDateTime & )
default

References WsfDateTime().

◆ ~WsfDateTime()

Member Function Documentation

◆ GetCurrentTime() [1/2]

◆ GetCurrentTime() [2/2]

void WsfDateTime::GetCurrentTime ( double aSimTime,
UtCalendar & aCurrentTime ) const

This is an optimized implementation of GetCurrentTime.

Parameters
aSimTimeThe current simulation time, in seconds.
aCurrentTime(in/out) The time at aSimTime as a UtCalendar.

References simTime.

◆ GetJulianDate()

double WsfDateTime::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.C.).

Parameters
aYearThe year of interest.
aMonthThe month of interest.
aDayThe day of interest.
aSecondsPastMidnightThe number of seconds past midnight on the day of interest.

Referenced by WsfL16::Interface::Initialize(), and ~WsfDateTime().

◆ GetStartDate()

void WsfDateTime::GetStartDate ( int & aYear,
int & aMonth,
int & aDay ) const

Get the start date of the simulation.

Parameters
aYearThe start year (output).
aMonthThe start month (output).
aDayThe start day (output).

Referenced by WsfL16::Interface::Initialize(), and ~WsfDateTime().

◆ GetStartDateAndTime()

◆ GetStartJulianDate()

double WsfDateTime::GetStartJulianDate ( ) const

Return the Julian date of the start date and time.

Returns
The number of days since 12:00:00 UTC on 1 January 4713 B.C., corresponding to the start date and time.

Referenced by WsfL16::Interface::Initialize(), and ~WsfDateTime().

◆ GetStartTime() [1/2]

double WsfDateTime::GetStartTime ( ) const

Get the time as the number of seconds past midnight of the start day.

Returns
The number of seconds past midnight of the start day. (i.e. Midnight= 0.0, 1AM=3600.0, Noon=43200.0, 11:59:59PM=86399.0)

◆ GetStartTime() [2/2]

void WsfDateTime::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.

Parameters
aHourThe start hour (output).
aMinuteThe start minute (output).
aSecondThe start second (output).

Referenced by ~WsfDateTime().

◆ operator=()

WsfDateTime & WsfDateTime::operator= ( const WsfDateTime & aRhs)
protecteddelete

operator= declared but not defined to prevent use.

References WsfDateTime().

◆ ProcessInput()

bool WsfDateTime::ProcessInput ( UtInput & aInput)

Process simulation input commands 'start_date' and 'start_time'.

Referenced by ~WsfDateTime().

◆ SetCurrentDateAndTime()

void WsfDateTime::SetCurrentDateAndTime ( )

Referenced by ~WsfDateTime().

◆ SetStartDate()

bool WsfDateTime::SetStartDate ( int aYear,
int aMonth,
int aDay )

Set the start date.

See the NOTE at the top of the file concerning the valid values.

Parameters
aYearThe year to which the date will be set.
aMonthThe month to which the date will be set.
aDayThe day to which the date will be set.

Referenced by ~WsfDateTime().

◆ SetStartEpoch()

bool WsfDateTime::SetStartEpoch ( double aEpoch)

Set the start time as the Epoch (year*1000 + day "." fractional day).

Parameters
aEpochThe epoch of the start time and date.

Referenced by ~WsfDateTime().

◆ SetStartTime()

bool WsfDateTime::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.

Parameters
aHourThe hour to which the time will be set.
aMinuteThe minute to which the time will be set.
aSecondThe second to which the time will be set.

Referenced by ~WsfDateTime().

◆ UsingSystemTime()

bool WsfDateTime::UsingSystemTime ( ) const

Return whether this object was initialized with system / wall clock time.

Referenced by ~WsfDateTime().


The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved