System Time Class
Topics
:Overview
Constants
Enumerations
Data Structures
Functions
Standalone Timer Functions
The SysTime class is used to convert the system time to various character string and integer formats.
// Year constants const int systimeYEAR_CONSTANT = 365; const int systimeLEAP_YEAR_CONSTANT = 366; // SysTime constants const int systimeSTART_YEAR = 1900; // Starting year const int systimeEND_YEAR = 2038; // Last valid year // Calender day constants const int systimeJANUARY = 31; const int systimeFEBUARY = 28; const int systimeFEB_LEAP = 29; const int systimeMARCH = 31; const int systimeAPRIL = 30; const int systimeMAY = 31; const int systimeJUNE = 30; const int systimeJULY = 31; const int systimeAUGUST = 31; const int systimeSEPTEMBER = 30; const int systimeOCTOBER = 31; const int systimeNOVEMBER = 30; const int systimeDECEMBER = 31;
enum { // Time formats SysTime::AMPM, // AM or PM SysTime::Date, // System date SysTime::DayOfTheMonth, // Day of the month (01..31) SysTime::DayOfTheWeek, // Day of the week (0..6, Sunday=0) SysTime::Hour, // Hour (24 hour clock - 00..23) SysTime::JDay, // Julian day SysTime::Minutes, // Minutes (00..59) SysTime::Month, // Month (01..12) SysTime::FullMonthName, // Full month name SysTime::MonthName, // Abbreviated month name SysTime::Seconds, // Seconds (00..59) SysTime::SystemTime, // System time SysTime::TimeZoneName, // Timezone name SysTime::WeekDayName, // Abbreviated weekday name SysTime::FullWeekDayName, // Full weekday name SysTime::WeekOfYearSF, // Week of the year (00..52, Sunday first) SysTime::WeekOfYearMF, // Week of the year (00..52, Monday first) SysTime::Year, // Year (0000..9999) SysTime::YearXX, // Year (00..99) SysTime::InvalidTimeFormat = 0xffff // Error code for invalid format };
// Time unit data structure used to store time values struct SysTimeUnit { char *c_str_Hours(); char *c_str_Minutes(); char *c_str_Seconds(); char *c_str_Milliseconds(); unsigned hours; unsigned minutes; unsigned seconds; unsigned milliseconds; };
SysTime::SysTime()
SysTime::DateSpan()
SysTime::DaysOld()
SysTime::FormatTime()
SysTime::GetGMTDateTime()
SysTime::GetIntTime()
SysTime::GetStrTime()
SysTime::GetSystemDate()
SysTime::GetSystemDateTime()
SysTime::GetSystemTime()
SysTime::InitTimeBuffers()
SysTime::IsLeapYear()
SysTime::SysTime()
- Default class constructor.int SysTime::DateSpan(char *s, unsigned days, int full_month_name = 0)
- Public member function used to calculate a date span from the current system time to the specified number of days. Returns false is an error occurs. This function assumes that memory has already been allocated for the "s" pointer.int SysTime::DaysOld(int jday, int year)
- Public member function used to calculate the number of days that have passed since the specified Julian day and four digit year.void SysTime::FormatTime(int Format)
- Public member function used to format the current system time. The "Format" variable must equal one of the integer constants defined in the time format enumeration.char *SysTime::GetGMTDateTime()
- Public member function used to make a date string in GMT time rather then local time. Returns a null terminated date string: Tue, 15 Nov 1994 08:12:31 GMTint SysTime::GetIntTime(int Format)
- Public member function that returns an integer value base on the specified time format. The "Format" variable must equal one of the integer constants defined in the time format enumeration.char *SysTime::GetStrTime(int Format)
- Public member function that returns a null-terminated string base on the specified time format. The "Format" variable must equal one of the integer constants defined in the time format enumeration.char *SysTime::GetSystemDate(int full_month_name = 0)
- Public member function used to copy the current system date into a null-terminated string.char *SysTime::GetSystemDateTime(int full_month_name = 0)
- Public member function used to copy the current system time and date into a null-terminated string.char *SysTime::GetSystemTime()
- Public member function used to copy the current system time into a null-terminated string.void SysTime::InitTimeBuffers()
- Public member function used to initialize the internal time buffers.int SysTime::IsLeapYear(int year)
- Public member function used to calculate leap years using the Gregorian leap year formula: 365 + 1/4 - 1/100 + 1/400. Returns true if the specified year is a leap year.void systimeSleep(clock_t seconds) -
Pauses program for a specified number of seconds.void systimePauseFor(clock_t wait)
- Pauses program for a specified number of milliseconds.clock_t systimeStart()
- Mark the starting time for a routine.clock_t systimeStop()
- Mark the stop time for a routine.clock_t systimeElapsedSeconds(clock_t begin, clock_t end)
- Calculate the elapsed time in seconds.double systimeElapsedTime(clock_t begin, clock_t end)
- Calculate the elapsed time in milliseconds.
End Of Document |