UA Server SDK C++ Bundle  1.3.2.200
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
UaDateTime Class Reference

Wrapper class for the UA stack structure OpcUa_DateTime. More...

#include <uadatetime.h>

Public Member Functions

 UaDateTime ()
 construction
 UaDateTime (const OpcUa_DateTime &)
 construction
virtual ~UaDateTime ()
 destruction
 UaDateTime (const FILETIME &)
 Construction with a FILETIME.
UaDateTimeoperator= (const FILETIME &)
 Assign a new time with a FILETIME.
 operator FILETIME () const
 Get the time as FILETIME.
 UaDateTime (const OpcUa_Int64 &)
 Construction with a OpcUa_Int64.
UaDateTimeoperator= (const OpcUa_Int64 &)
 Assign a new time with a OpcUa_Int64.
 operator OpcUa_Int64 () const
 Get the time as OpcUa_Int64.
 operator OpcUa_DateTime () const
 Get the UaDateTime.
bool operator< (const UaDateTime &other) const
 Operator for comparing.
bool operator> (const UaDateTime &other) const
 Operator for comparing.
bool operator== (const UaDateTime &other) const
 Compare variables if they are similar.
bool operator!= (const UaDateTime &other) const
 Returns true if other is not equal to this.
UaString toString () const
 Converts the UaDateTime into a UaString.
UaString toDateString () const
 Convert a date to a string.
UaString toTimeString () const
 Convert a time to a string.
time_t toTime_t () const
 Converts the UA DateTime to UNIX timestamp format time_t.
int msec () const
 Returns the milliseconds part of this dateTime.
OpcUa_Boolean isNull () const
 Check whether UaDateTime is null or not.
OpcUa_Int32 daysTo (const UaDateTime &) const
 Get the days.
OpcUa_Int32 secsTo (const UaDateTime &) const
 Get the seconds.
OpcUa_Int32 msecsTo (const UaDateTime &) const
 Get the milliseconds.
void addSecs (int secs)
 Adds seconds to the date time.
void addMilliSecs (int msecs)
 Adds milliseconds to the date time.

Static Public Member Functions

static UaDateTime now ()
 Get the Date and Time of now.
static UaDateTime fromString (const UaString &)
 Get UaDateTime from string in ISO 8601 format.
static UaDateTime fromTime_t (time_t tim)
 Get UaDateTime from time_t.

Detailed Description

Wrapper class for the UA stack structure OpcUa_DateTime.

Helper class for modifying UaDateTime elements. The UaDateTime class provides date and time functions.

Constructor & Destructor Documentation

UaDateTime::UaDateTime ( const OpcUa_DateTime &  dateTime)

construction

Parameters
dateTimethe actual date time
UaDateTime::UaDateTime ( const FILETIME &  fileTime)

Construction with a FILETIME.

Parameters
fileTimeThe time as FILETIME.
UaDateTime::UaDateTime ( const OpcUa_Int64 &  time)

Construction with a OpcUa_Int64.

Parameters
timeThe time as OpcUa_Int64.

Member Function Documentation

void UaDateTime::addMilliSecs ( int  msecs)

Adds milliseconds to the date time.

Parameters
msecsthe milliseconds.
void UaDateTime::addSecs ( int  secs)

Adds seconds to the date time.

Parameters
secsthe seconds.
OpcUa_Int32 UaDateTime::daysTo ( const UaDateTime to) const

Get the days.

Parameters
tothe UaDateTime to convert.
Returns
the days.
UaDateTime UaDateTime::fromString ( const UaString sTime)
static

Get UaDateTime from string in ISO 8601 format.

ISO 8601 string format is specified in the following form "YYYY-MM-DDThh:mm:ss" where:

  • YYYY indicates the year
  • MM indicates the month
  • DD indicates the day
  • T indicates the start of the required time section
  • hh indicates the hour
  • mm indicates the minute
  • ss indicates the second
    Example: 2002-05-30T09:00:00
    Note: All components are required!
    Time Zones:
    To specify a time zone, you can either enter a dateTime in UTC time by adding a "Z" behind the time - like this: 2002-05-30T09:30:10Z
    or you can specify an offset from the UTC time by adding a positive or negative time behind the time - like this: 2002-05-30T09:30:10-06:00 or 2002-05-30T09:30:10+06:00
Parameters
sTimethe string to convert.
Returns
UaDateTime from string.
UaDateTime UaDateTime::fromTime_t ( time_t  tim)
static

Get UaDateTime from time_t.

Parameters
timthe time_t struct to convert.
Returns
UaDateTime from time_t.
OpcUa_Boolean UaDateTime::isNull ( ) const

Check whether UaDateTime is null or not.

Returns
true if null false if not.
int UaDateTime::msec ( ) const

Returns the milliseconds part of this dateTime.

Returns
the milliseconds part of this dateTime.
OpcUa_Int32 UaDateTime::msecsTo ( const UaDateTime to) const

Get the milliseconds.

Parameters
tothe UaDateTime to convert.
Returns
the milliseconds.
UaDateTime UaDateTime::now ( )
static

Get the Date and Time of now.

Returns
the date and the time of now.
UaDateTime::operator FILETIME ( ) const

Get the time as FILETIME.

Returns
the FILETIME.
UaDateTime::operator OpcUa_DateTime ( ) const

Get the UaDateTime.

Returns
the UaDateTime.
UaDateTime::operator OpcUa_Int64 ( ) const

Get the time as OpcUa_Int64.

Returns
the OpcUa_Int64.
bool UaDateTime::operator!= ( const UaDateTime other) const

Returns true if other is not equal to this.

See Also
operator==
Parameters
otherthe UaString to compare.
Returns
true if other is not equal to this.
bool UaDateTime::operator< ( const UaDateTime other) const

Operator for comparing.

Parameters
otherthe UaDateTime to compare.
Returns
true if smaller false if not.
UaDateTime & UaDateTime::operator= ( const FILETIME &  fileTime)

Assign a new time with a FILETIME.

Parameters
fileTimeThe time as FILETIME.
Returns
the date time.
UaDateTime & UaDateTime::operator= ( const OpcUa_Int64 &  time)

Assign a new time with a OpcUa_Int64.

Parameters
timeThe time as OpcUa_Int64.
Returns
the date time.
bool UaDateTime::operator== ( const UaDateTime other) const

Compare variables if they are similar.

Parameters
otherthe char to compare.
Returns
true if not similar false if similar.
bool UaDateTime::operator> ( const UaDateTime other) const

Operator for comparing.

Parameters
otherthe UaDateTime to compare.
Returns
true if bigger false if not.
OpcUa_Int32 UaDateTime::secsTo ( const UaDateTime to) const

Get the seconds.

Parameters
tothe UaDateTime to convert.
Returns
the seconds.
UaString UaDateTime::toDateString ( ) const

Convert a date to a string.

Returns
the string of the date.
UaString UaDateTime::toString ( ) const

Converts the UaDateTime into a UaString.

Returns
the converted UaDateTime.
time_t UaDateTime::toTime_t ( ) const

Converts the UA DateTime to UNIX timestamp format time_t.

Note: This format only has a precision of seconds. The ms part will be cut. Also the time range is different and goes from 1970-01-01 till 2038-01-18 on 32bit systems.

Returns
UNIX timestamp format time_t.
UaString UaDateTime::toTimeString ( ) const

Convert a time to a string.

Returns
the string of the time.

The documentation for this class was generated from the following files: