ezEngine  Milestone 7
ezDateTime Class Reference

The ezDateTime class can be used to convert ezTimestamp into a human readable form. More...

#include <Timestamp.h>

Public Member Functions

 ezDateTime ()
 Creates an empty date time instance with an invalid date. More...
 
 ezDateTime (ezTimestamp timestamp)
 Creates a date time instance from the given timestamp.
 
const ezTimestamp GetTimestamp () const
 Converts this instance' values into a ezTimestamp. More...
 
bool SetTimestamp (ezTimestamp timestamp)
 Sets this instance to the given timestamp. More...
 
ezUInt32 GetYear () const
 Returns the currently set year.
 
void SetYear (ezInt16 iYear)
 Sets the year to the given value.
 
ezUInt8 GetMonth () const
 Returns the currently set month.
 
void SetMonth (ezUInt8 uiMonth)
 Sets the month to the given value, will be clamped to valid range [1, 12].
 
ezUInt8 GetDay () const
 Returns the currently set day.
 
void SetDay (ezUInt8 uiDay)
 Sets the day to the given value, will be clamped to valid range [1, 31].
 
ezUInt8 GetHour () const
 Returns the currently set hour.
 
void SetHour (ezUInt8 uiHour)
 Sets the hour to the given value, will be clamped to valid range [0, 23].
 
ezUInt8 GetMinute () const
 Returns the currently set minute.
 
void SetMinute (ezUInt8 uiMinute)
 Sets the minute to the given value, will be clamped to valid range [0, 59].
 
ezUInt8 GetSecond () const
 Returns the currently set second.
 
void SetSecond (ezUInt8 uiSecond)
 Sets the second to the given value, will be clamped to valid range [0, 59].
 
ezUInt32 GetMicroseconds () const
 Returns the currently set microseconds.
 
void SetMicroseconds (ezUInt32 uiMicroSeconds)
 Sets the microseconds to the given value, will be clamped to valid range [0, 999999].
 

Private Attributes

ezUInt32 m_uiMicroseconds
 The fraction of a second in microseconds of this date [0, 999999].
 
ezInt16 m_iYear
 The year of this date [-32k, +32k].
 
ezUInt8 m_uiMonth
 The month of this date [1, 12].
 
ezUInt8 m_uiDay
 The day of this date [1, 31].
 
ezUInt8 m_uiHour
 The hour of this date [0, 23].
 
ezUInt8 m_uiMinute
 The number of minutes of this date [0, 59].
 
ezUInt8 m_uiSecond
 The number of seconds of this date [0, 59].
 

Detailed Description

The ezDateTime class can be used to convert ezTimestamp into a human readable form.

Note: As ezTimestamp is microseconds since Unix epoch, the values in this class will always be in UTC.

Constructor & Destructor Documentation

ezDateTime::ezDateTime ( )

Creates an empty date time instance with an invalid date.

Day, Month and Year will be invalid and must be set.

Member Function Documentation

const ezTimestamp ezDateTime::GetTimestamp ( ) const

Converts this instance' values into a ezTimestamp.

The conversion is done via the OS and can fail for values that are outside the supported range. In this case, the returned value will be invalid. Anything after 1970 and before the not so distant future should be safe.

bool ezDateTime::SetTimestamp ( ezTimestamp  timestamp)

Sets this instance to the given timestamp.

The conversion is done via the OS and will fail for invalid dates and values outside the supported range, in which case false will be returned. Anything after 1970 and before the not so distant future should be safe.


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