wavelength 1.0.0
Loading...
Searching...
No Matches
DateTime Class Reference

Local date and time of the console clock. More...

#include <datetime.h>

Public Member Functions

 DateTime ()=default
 Construct a date whose fields are not set.
 DateTime (unsigned int nSeconds)
 Construct a date from a count of seconds ToSeconds() reported.
bool ReadClock ()
 Read the console clock.
unsigned int ToSeconds () const
 Report the date as a count of seconds, with 32-day months and 384-day years from 2000.
void FormatDateTime (String &text) const
 Write the date and time as "MM/DD/YYYY HH:MM:SS", or "DD.MM.YYYY HH:MM:SS" in the PAL build.
void FormatDate (String &text) const
 Write the date as "MM/DD/YYYY", or "DD.MM.YYYY" in the PAL build.
void FormatMonthDay (String &text) const
 Write the month and the day as "MM/DD", or "DD.MM" in the PAL build.
void FormatShortDate (String &text) const
 Write the date as "MM/DD/YY", or "DD.MM.YY" in the PAL build, the year counted from 2000.
bool operator< (const DateTime &other) const
 Report whether this date is earlier than another.
unsigned char GetSecond () const
void SetSecond (unsigned char nSecond)
unsigned char GetMinute () const
void SetMinute (unsigned char nMinute)
unsigned char GetHour () const
void SetHour (unsigned char nHour)
unsigned char GetDay () const
void SetDay (unsigned char nDay)
unsigned char GetMonth () const
void SetMonth (unsigned char nMonth)
unsigned char GetYear () const
void SetYear (unsigned char nYear)
void ToString (String &out) const
 Write the date and time as MM/DD/YYYY hh:mm:ss.

Static Public Member Functions

static void PollClock ()
 Start a read of the console clock on the worker thread once 30 seconds have passed since the last read.

Public Attributes

unsigned char mSec
unsigned char mMin

Detailed Description

Local date and time of the console clock.

Local calendar date and time of day, one byte per field.

The type has no RTTI, and the name is inferred. Callers clear it before ReadClock() fills it. ReadClock() returns the clock reading PollClock() last refreshed, which a task of the worker thread reads every 30 seconds.

The object is 6 bytes. The name is inferred from the routines that fill and print it.

Constructor & Destructor Documentation

◆ DateTime() [1/2]

DateTime::DateTime ( )
default

Construct a date whose fields are not set.

◆ DateTime() [2/2]

DateTime::DateTime ( unsigned int nSeconds)
explicit

Construct a date from a count of seconds ToSeconds() reported.

The name is inferred.

Parameters
nSecondsThe seconds.
Ghidra address:
NTSC-U/C: 0x002888f0
Ghidra address:
PAL: 0x002921a0

Member Function Documentation

◆ ReadClock()

bool DateTime::ReadClock ( )

Read the console clock.

The first call reads the clock and starts the 30-second refresh. Each field is converted from its BCD byte.

Returns
False, with no field written, when the clock reports an error.
Ghidra address:
NTSC-U/C: 0x00288648
Ghidra address:
PAL: 0x00291ef8

◆ PollClock()

void DateTime::PollClock ( )
static

Start a read of the console clock on the worker thread once 30 seconds have passed since the last read.

SystemPoll() calls it once per frame.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00288778
Ghidra address:
PAL: 0x00292028

◆ ToSeconds()

unsigned int DateTime::ToSeconds ( ) const

Report the date as a count of seconds, with 32-day months and 384-day years from 2000.

The count orders dates but is not a calendar count.

The name is inferred.

Returns
The seconds.
Ghidra address:
NTSC-U/C: 0x002889a0
Ghidra address:
PAL: 0x00292250

◆ FormatDateTime()

void DateTime::FormatDateTime ( String & text) const

Write the date and time as "MM/DD/YYYY HH:MM:SS", or "DD.MM.YYYY HH:MM:SS" in the PAL build.

The name is inferred.

Parameters
textReceives the date and time.
Ghidra address:
NTSC-U/C: 0x00288a08
Ghidra address:
PAL: 0x002922b8

◆ FormatDate()

void DateTime::FormatDate ( String & text) const

Write the date as "MM/DD/YYYY", or "DD.MM.YYYY" in the PAL build.

The name is inferred.

Parameters
textReceives the date.
Ghidra address:
NTSC-U/C: 0x00288a68
Ghidra address:
PAL: 0x00292318

◆ FormatMonthDay()

void DateTime::FormatMonthDay ( String & text) const

Write the month and the day as "MM/DD", or "DD.MM" in the PAL build.

The name is inferred.

Parameters
textReceives the month and the day.
Ghidra address:
NTSC-U/C: 0x00288ab8
Ghidra address:
PAL: 0x00292368

◆ FormatShortDate()

void DateTime::FormatShortDate ( String & text) const

Write the date as "MM/DD/YY", or "DD.MM.YY" in the PAL build, the year counted from 2000.

The name is inferred.

Parameters
textReceives the date.
Ghidra address:
NTSC-U/C: 0x00288b00
Ghidra address:
PAL: 0x002923b0

◆ operator<()

bool DateTime::operator< ( const DateTime & other) const

Report whether this date is earlier than another.

Parameters
otherThe other date.
Returns
Whether this date comes first.
Ghidra address:
NTSC-U/C: 0x00288b50
Ghidra address:
PAL: 0x00292400

◆ GetSecond()

unsigned char DateTime::GetSecond ( ) const
inline
Returns
The second, 0 to 59.

◆ SetSecond()

void DateTime::SetSecond ( unsigned char nSecond)
inline
Parameters
nSecondThe second, 0 to 59.

◆ GetMinute()

unsigned char DateTime::GetMinute ( ) const
inline
Returns
The minute, 0 to 59.

◆ SetMinute()

void DateTime::SetMinute ( unsigned char nMinute)
inline
Parameters
nMinuteThe minute, 0 to 59.

◆ GetHour()

unsigned char DateTime::GetHour ( ) const
inline
Returns
The hour, 0 to 23.

◆ SetHour()

void DateTime::SetHour ( unsigned char nHour)
inline
Parameters
nHourThe hour, 0 to 23.

◆ GetDay()

unsigned char DateTime::GetDay ( ) const
inline
Returns
The day of the month, from 1.

◆ SetDay()

void DateTime::SetDay ( unsigned char nDay)
inline
Parameters
nDayThe day of the month, from 1.

◆ GetMonth()

unsigned char DateTime::GetMonth ( ) const
inline
Returns
The month, from 0.

◆ SetMonth()

void DateTime::SetMonth ( unsigned char nMonth)
inline
Parameters
nMonthThe month, from 0.

◆ GetYear()

unsigned char DateTime::GetYear ( ) const
inline
Returns
The years since 1900.

◆ SetYear()

void DateTime::SetYear ( unsigned char nYear)
inline
Parameters
nYearThe years since 1900.

◆ ToString()

void DateTime::ToString ( String & out) const

Write the date and time as MM/DD/YYYY hh:mm:ss.

Parameters
outReceives the text.
Ghidra address:
0x1000ea40

Member Data Documentation

◆ mSec

unsigned char DateTime::mSec

Seconds, 0 to 59.

◆ mMin

unsigned char DateTime::mMin

Minutes, 0 to 59.


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