The C++ framework for developing highly scalable, high performance servers on Windows platforms.

CSystemTime Class Reference

Inheritance diagram for CSystemTime:
Collaboration diagram for CSystemTime:

List of all members.


Detailed Description

A simple class that wraps, and initialises, and manipulates a SYSTEMTIME structure.


Public Member Functions

 CSystemTime ()
 Construct a zero initialised SYSTEMTIME.
 CSystemTime (__int64 dateTime)
 Constructs a SYSTEMTIME with the specified date/time.
 CSystemTime (const FILETIME &fileTime)
 Constructs a SYSTEMTIME from a FILETIME...
 CSystemTime (const SYSTEMTIME &systemTime)
 Constructs a SYSTEMTIME with the specified SYSTEMTIME...
 CSystemTime (const _tstring &yyyymmddhhmmssmmm)
 Constructs a SYSTEMTIME with the specified date/time in "YYYYMMDD HHMMSS[MMM]" or "YYYYMMDD" or "HHMMSS[MMM]" or format (in all cases the millisecond time component is optional).
void GetSystemTime ()
 Calls the operating system's GetSystemTime() with this object.
void GetLocalTime ()
 Calls the operating system's GetLocalTime() with this object.
void CopyDateTo (SYSTEMTIME &destination) const
 Copies just the date portion of this object to the supplied SYSTEMTIME.
void CopyTimeTo (SYSTEMTIME &destination) const
 Copies just the time portion of this object to the supplied SYSTEMTIME.
bool TryParseDate (const _tstring &ddmmyyyy)
 Attempts to parse a DDMMYYYY date into the current object, returns false on failure.
void ParseDate (const _tstring &ddmmyyyy)
 Parses a DDMMYYYY date into the current object, throws an exception on failure.
bool TryParseTime (const _tstring &hhmmssmmm)
 Attempts to parse an HHMMSS[MMM] time into the current object, returns false on failure (the millisecond time component is optional).
void ParseTime (const _tstring &hhmmssmmm)
 Parses an HHMMSS[MMM] time into the current object, throws an exception on failure (the millisecond time component is optional).
void SetAsSystemTimeFromLocalTime (const SYSTEMTIME &localTime)
void SetAsSystemTimeFromLocalTime (const SYSTEMTIME &localTime, const TIME_ZONE_INFORMATION &timeZoneInformation)
void SetAsLocalTimeFromSystemTime (const SYSTEMTIME &systemTime)
void SetAsLocalTimeFromSystemTime (const SYSTEMTIME &systemTime, const TIME_ZONE_INFORMATION &timeZoneInformation)
void SetFromTimeT32 (__time32_t timet)
void SetFromTimeT64 (__time64_t timet)
__time32_t GetSystemTimeAsTimeT32 () const
__time64_t GetSystemTimeAsTimeT64 () const
time_t GetSystemTimeAsTimeT () const
__time32_t GetLocalTimeAsTimeT32 () const
__time64_t GetLocalTimeAsTimeT64 () const
time_t GetLocalTimeAsTimeT () const
_tstring GetAsYYYYMMDD () const
 Returns the date in YYYYMMDD format.
_tstring GetAsHHMMSS () const
 Returns the time HHMMSS format (and strips any milliseconds that may be present).
_tstring GetAsHHMMSSMMM () const
 Returns the time HHMMSSMMM format (includes milliseconds).
_tstring GetAsDatabaseDateTimeStamp () const
 Returns the time YYYY-MM-DD HH:MM:SS.MMM format (SQL Server Date/Time format).
std::string GetAsDatabaseDateTimeStampA () const
_tstring GetAsHTTPDate () const
 Returns the date/time in HTML format (Tue, 15 Nov 1994 08:12:31 GMT).
std::string GetAsHTTPDateA () const
bool ContainsDate () const
bool IsValid () const
void SetToBaseDate ()
 Sets the object's date portion to the base date for a SYSTEMTIME, 1st Jan 1601.
__int64 GetAsInt64 () const
 Gets the SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
__int64 GetDateAsInt64 () const
 Gets the date portion of this SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
__int64 GetTimeAsInt64 () const
 Gets the time portion of this SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since the day began.
__int64 GetAsMilliseconds () const
 Gets the SYSTEMTIME as an Int64 value representing the number of milliseconds since January 1, 1601 (UTC).
__int64 GetDateAsMilliseconds () const
 Gets the date portion of this SYSTEMTIME as an Int64 value representing the number of milliseconds since January 1, 1601 (UTC).
__int64 GetTimeAsMilliseconds () const
 Gets the time portion of this SYSTEMTIME as an Int64 value representing the number of milliseconds since the day began.
void AddDays (int days)
 Adds the specified number of months to the date.
void AddMonths (int months)
 Adds the specified number of months to the date.
void AddYears (int years)
 Adds the specified number of years to the date.
WORD GetDaysInMonth () const
 Returns the number of days in the month.
bool IsLeapYear () const
 Returns true if the year is a leap year.
int GetYearsDifferent (const SYSTEMTIME &secondDate) const
 Returns the number of complete years between the two dates.
int GetMonthsDifferent (const SYSTEMTIME &secondDate) const
 Returns the number of complete months between the two dates.
int GetDaysDifferent (const SYSTEMTIME &secondDate) const
 Returns the number of days between the two dates.

Static Public Member Functions

static void GetSystemTime (SYSTEMTIME &systemTime)
static void GetLocalTime (SYSTEMTIME &systemTime)
static WORD GetDaysInMonth (WORD year, WORD month)
 Returns the number of days in the specified month.
static WORD GetDaysInMonth (const SYSTEMTIME &date)
 Returns the number of days in the month of the supplied date.
static bool IsLeapYear (WORD year)
 Returns true if the supplied year is a leap year.
static bool IsLeapYear (const SYSTEMTIME &date)
 Returns true if the supplied date is in a leap year.
static int GetYearsDifferent (const SYSTEMTIME &firstDate, const SYSTEMTIME &secondDate)
 Returns the number of complete years between the two dates.
static int GetMonthsDifferent (const SYSTEMTIME &firstDate, const SYSTEMTIME &secondDate)
 Returns the number of complete months between the two dates.
static int GetDaysDifferent (const SYSTEMTIME &firstDate, const SYSTEMTIME &secondDate)
 Returns the number of days between the two dates.
static void CopyDateTo (const SYSTEMTIME &source, SYSTEMTIME &destination)
 Copies just the date portion of the source to the destination.
static void CopyTimeTo (const SYSTEMTIME &source, SYSTEMTIME &destination)
 Copies just the time portion of the source to the destination.
static __int64 GetAsInt64 (const SYSTEMTIME &source)
 Gets the SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
static __int64 GetDateAsInt64 (const SYSTEMTIME &source)
 Gets the date portion of this SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
static __int64 GetTimeAsInt64 (const SYSTEMTIME &source)
 Gets the time portion of this SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since the day began.
static __int64 GetAsMilliseconds (const SYSTEMTIME &source)
 Gets the SYSTEMTIME as an Int64 value representing the number of milliseconds since January 1, 1601 (UTC).
static __int64 GetDateAsMilliseconds (const SYSTEMTIME &source)
 Gets the date portion of this SYSTEMTIME as an Int64 value representing the number of milliseconds since January 1, 1601 (UTC).
static __int64 GetTimeAsMilliseconds (const SYSTEMTIME &source)
 Gets the time portion of this SYSTEMTIME as an Int64 value representing the number of milliseconds since the day began.
static _tstring GetLocalTimeNowTimestamp ()
static std::string GetLocalTimeNowTimestampA ()

Static Public Attributes

static
JETBYTE_CONSTEXPR
__int64 
IntervalsInAMillisecond = 10000
 The number of Int64 intervals in a Millisecond, you can use this to convert between the Int64 values returned and Milliseconds.

Classes

class  DateDifference
 A simple class that helps to manipluate the difference in date (only) between two SYSTEMTIMEs. More...
class  TimeDifference
 A simple class that helps to manipluate the difference in time (only) between two SYSTEMTIMEs. More...


Constructor & Destructor Documentation

CSystemTime (  ) 

Construct a zero initialised SYSTEMTIME.

CSystemTime ( __int64  dateTime  )  [explicit]

Constructs a SYSTEMTIME with the specified date/time.

CSystemTime ( const FILETIME &  fileTime  )  [explicit]

Constructs a SYSTEMTIME from a FILETIME...

CSystemTime ( const SYSTEMTIME systemTime  )  [explicit]

Constructs a SYSTEMTIME with the specified SYSTEMTIME...

CSystemTime ( const _tstring yyyymmddhhmmssmmm  )  [explicit]

Constructs a SYSTEMTIME with the specified date/time in "YYYYMMDD HHMMSS[MMM]" or "YYYYMMDD" or "HHMMSS[MMM]" or format (in all cases the millisecond time component is optional).


Member Function Documentation

void GetSystemTime ( SYSTEMTIME systemTime  )  [static]

void GetLocalTime ( SYSTEMTIME systemTime  )  [static]

void GetSystemTime (  ) 

Calls the operating system's GetSystemTime() with this object.

void GetLocalTime (  ) 

Calls the operating system's GetLocalTime() with this object.

void CopyDateTo ( SYSTEMTIME destination  )  const

Copies just the date portion of this object to the supplied SYSTEMTIME.

void CopyTimeTo ( SYSTEMTIME destination  )  const

Copies just the time portion of this object to the supplied SYSTEMTIME.

bool TryParseDate ( const _tstring ddmmyyyy  ) 

Attempts to parse a DDMMYYYY date into the current object, returns false on failure.

void ParseDate ( const _tstring ddmmyyyy  ) 

Parses a DDMMYYYY date into the current object, throws an exception on failure.

bool TryParseTime ( const _tstring hhmmssmmm  ) 

Attempts to parse an HHMMSS[MMM] time into the current object, returns false on failure (the millisecond time component is optional).

void ParseTime ( const _tstring hhmmssmmm  ) 

Parses an HHMMSS[MMM] time into the current object, throws an exception on failure (the millisecond time component is optional).

void SetAsSystemTimeFromLocalTime ( const SYSTEMTIME localTime  ) 

void SetAsSystemTimeFromLocalTime ( const SYSTEMTIME localTime,
const TIME_ZONE_INFORMATION &  timeZoneInformation 
)

void SetAsLocalTimeFromSystemTime ( const SYSTEMTIME systemTime  ) 

void SetAsLocalTimeFromSystemTime ( const SYSTEMTIME systemTime,
const TIME_ZONE_INFORMATION &  timeZoneInformation 
)

void SetFromTimeT32 ( __time32_t  timet  ) 

void SetFromTimeT64 ( __time64_t  timet  ) 

__time32_t GetSystemTimeAsTimeT32 (  )  const

__time64_t GetSystemTimeAsTimeT64 (  )  const

time_t GetSystemTimeAsTimeT (  )  const [inline]

__time32_t GetLocalTimeAsTimeT32 (  )  const

__time64_t GetLocalTimeAsTimeT64 (  )  const

time_t GetLocalTimeAsTimeT (  )  const [inline]

_tstring GetAsYYYYMMDD (  )  const

Returns the date in YYYYMMDD format.

_tstring GetAsHHMMSS (  )  const

Returns the time HHMMSS format (and strips any milliseconds that may be present).

_tstring GetAsHHMMSSMMM (  )  const

Returns the time HHMMSSMMM format (includes milliseconds).

_tstring GetAsDatabaseDateTimeStamp (  )  const

Returns the time YYYY-MM-DD HH:MM:SS.MMM format (SQL Server Date/Time format).

string GetAsDatabaseDateTimeStampA (  )  const

_tstring GetAsHTTPDate (  )  const

Returns the date/time in HTML format (Tue, 15 Nov 1994 08:12:31 GMT).

string GetAsHTTPDateA (  )  const

bool ContainsDate (  )  const

bool IsValid (  )  const

void SetToBaseDate (  ) 

Sets the object's date portion to the base date for a SYSTEMTIME, 1st Jan 1601.

__int64 GetAsInt64 (  )  const

Gets the SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).

__int64 GetDateAsInt64 (  )  const

Gets the date portion of this SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).

__int64 GetTimeAsInt64 (  )  const

Gets the time portion of this SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since the day began.

__int64 GetAsMilliseconds (  )  const

Gets the SYSTEMTIME as an Int64 value representing the number of milliseconds since January 1, 1601 (UTC).

__int64 GetDateAsMilliseconds (  )  const

Gets the date portion of this SYSTEMTIME as an Int64 value representing the number of milliseconds since January 1, 1601 (UTC).

__int64 GetTimeAsMilliseconds (  )  const

Gets the time portion of this SYSTEMTIME as an Int64 value representing the number of milliseconds since the day began.

void AddDays ( int  days  ) 

Adds the specified number of months to the date.

void AddMonths ( int  months  ) 

Adds the specified number of months to the date.

void AddYears ( int  years  ) 

Adds the specified number of years to the date.

WORD GetDaysInMonth (  )  const

Returns the number of days in the month.

bool IsLeapYear (  )  const

Returns true if the year is a leap year.

int GetYearsDifferent ( const SYSTEMTIME secondDate  )  const

Returns the number of complete years between the two dates.

int GetMonthsDifferent ( const SYSTEMTIME secondDate  )  const

Returns the number of complete months between the two dates.

int GetDaysDifferent ( const SYSTEMTIME secondDate  )  const

Returns the number of days between the two dates.

WORD GetDaysInMonth ( WORD  year,
WORD  month 
) [static]

Returns the number of days in the specified month.

WORD GetDaysInMonth ( const SYSTEMTIME date  )  [static]

Returns the number of days in the month of the supplied date.

bool IsLeapYear ( WORD  year  )  [static]

Returns true if the supplied year is a leap year.

bool IsLeapYear ( const SYSTEMTIME date  )  [static]

Returns true if the supplied date is in a leap year.

int GetYearsDifferent ( const SYSTEMTIME firstDate,
const SYSTEMTIME secondDate 
) [static]

Returns the number of complete years between the two dates.

int GetMonthsDifferent ( const SYSTEMTIME firstDate,
const SYSTEMTIME secondDate 
) [static]

Returns the number of complete months between the two dates.

int GetDaysDifferent ( const SYSTEMTIME firstDate,
const SYSTEMTIME secondDate 
) [static]

Returns the number of days between the two dates.

void CopyDateTo ( const SYSTEMTIME source,
SYSTEMTIME destination 
) [static]

Copies just the date portion of the source to the destination.

void CopyTimeTo ( const SYSTEMTIME source,
SYSTEMTIME destination 
) [static]

Copies just the time portion of the source to the destination.

__int64 GetAsInt64 ( const SYSTEMTIME source  )  [static]

Gets the SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).

__int64 GetDateAsInt64 ( const SYSTEMTIME source  )  [static]

Gets the date portion of this SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).

__int64 GetTimeAsInt64 ( const SYSTEMTIME source  )  [static]

Gets the time portion of this SYSTEMTIME as an Int64 value representing the number of 100-nanosecond intervals since the day began.

__int64 GetAsMilliseconds ( const SYSTEMTIME source  )  [static]

Gets the SYSTEMTIME as an Int64 value representing the number of milliseconds since January 1, 1601 (UTC).

__int64 GetDateAsMilliseconds ( const SYSTEMTIME source  )  [static]

Gets the date portion of this SYSTEMTIME as an Int64 value representing the number of milliseconds since January 1, 1601 (UTC).

__int64 GetTimeAsMilliseconds ( const SYSTEMTIME source  )  [static]

Gets the time portion of this SYSTEMTIME as an Int64 value representing the number of milliseconds since the day began.

_tstring GetLocalTimeNowTimestamp (  )  [static]

string GetLocalTimeNowTimestampA (  )  [static]


Member Data Documentation

JETBYTE_CONSTEXPR __int64 IntervalsInAMillisecond = 10000 [static]

The number of Int64 intervals in a Millisecond, you can use this to convert between the Int64 values returned and Milliseconds.


Generated on Sun Sep 12 19:09:06 2021 for The Server Framework - v7.4 by doxygen 1.5.3