![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
< similar to the MFC CTime and cTimeSpan, not as accurate or large ranged as COleDateTime More...
#include <cTimeInt.h>
Public Member Functions | |
cTimeInt () | |
cTimeInt (TIMESEC_t time) | |
cTimeInt (const cTimeFile &fileTime) | |
cTimeInt (const cTimeUnits &rTu) | |
cTimeInt (double dTimeDays) | |
void | InitTimeNow () |
void | InitTimeNowPlusSec (TIMESECD_t iOffsetInSeconds) |
void | InitTime (TIMESEC_t nTime=k_nZero) |
cTimeFile | GetAsFileTime () const |
bool | GetTimeUnits (OUT cTimeUnits &rTu, TZ_TYPE nTimeZoneOffset=TZ_UTC) const |
TIMESECD_t | GetSecondsSince (const cTimeInt &time) const |
TIMESECD_t | get_TimeTilSec () const |
TIMESECD_t | get_AgeSec () const |
bool | isTimeFuture () const |
bool | isTimeValid () const |
int | get_TotalDays () const |
HRESULT | SetTimeStr (const GChar_t *pszTimeDate, TZ_TYPE nTimeZoneOffset=TZ_LOCAL) |
StrLen_t | GetTimeFormStr (GChar_t *pszOut, StrLen_t iOutSizeMax, const GChar_t *pszFormat, TZ_TYPE nTimeZoneOffset=TZ_LOCAL) const |
cString | GetTimeFormStr (const GChar_t *pszFormat=nullptr, TZ_TYPE nTimeZoneOffset=TZ_LOCAL) const |
cString | GetTimeFormStr (TIME_FORMAT_TYPE eFormat, TZ_TYPE nTimeZoneOffset=TZ_LOCAL) const |
![]() | |
CTime (TIMESEC_t nTime=((TIMESEC_t) 0)) noexcept | |
CTime (const cTimeFile &fileTime, int nDST=-1) | |
const CTime & | operator= (const CTime &timeSrc) noexcept |
const CTime & | operator= (TIMESEC_t nTime) noexcept |
bool | operator<= (TIMESEC_t nTime) const noexcept |
bool | operator== (TIMESEC_t nTime) const noexcept |
bool | operator!= (TIMESEC_t nTime) const noexcept |
bool | operator>= (CTime ttime) const noexcept |
operator TIMESEC_t () const noexcept | |
TIMESEC_t | GetTime () const noexcept |
TIMESEC_t | GetTotalSeconds () const noexcept |
Static Public Member Functions | |
static TIMESEC_t __stdcall | GetTimeFromDays (double dTimeDays) noexcept |
static cTimeInt __stdcall | GetTimeFromStr (const GChar_t *pszDateTime, TZ_TYPE nTimeZoneOffset) |
static cTimeInt __stdcall | GetTimeNow () noexcept |
static cTimeInt __stdcall | GetCurrentTime () noexcept |
static bool | IsTimeValid (TIMESEC_t nTime) |
static cString __stdcall | GetTimeSpanStr (TIMESECD_t dwSeconds, TIMEUNIT_TYPE eUnitHigh=TIMEUNIT_Day, int iUnitsDesired=2, bool bShortText=false) |
static cString __stdcall | GetTimeDeltaBriefStr (TIMESECD_t dwSeconds) |
static cString __stdcall | GetTimeDeltaSecondsStr (TIMESECD_t dwSeconds) |
Static Public Attributes | |
static const TIMESEC_t | k_nZero = ((TIMESEC_t)0) |
January 1, 1970 UTC. More... | |
static const TIMESEC_t | k_nY2K = ((TIMESEC_t)0x386d4380) |
The static value for Y2K = January 1, 2000 in UTC/GMT from k_nZero in seconds. More... | |
Protected Member Functions | |
bool | InitTimeUnits (const cTimeUnits &rTu) |
Friends | |
class | cTimeIntTests |
Additional Inherited Members | |
![]() | |
TIMESEC_t | m_time |
Seconds. Essentially the UNIX long time format. (not usable after 2018 unless 64 bit?) More... | |
< similar to the MFC CTime and cTimeSpan, not as accurate or large ranged as COleDateTime
< no need to dupe MFC function.
the number of seconds elapsed since midnight (00:00:00), January 1, 1970, coordinated universal time (UTC), according to the system clock ASSUME __time64_t is signed! MFC uses __time64_t Same as UNIX_TIMESTAMP() for MySQL
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
How old is this? (in seconds) current time - this time.
|
inline |
difference in seconds
|
inline |
Needs to be more consistent than accurate. just for compares. Should turn over at midnight.
cTimeFile Gray::cTimeInt::GetAsFileTime | ( | ) | const |
|
inlinestaticnoexcept |
Alternate name for MFC.
|
inline |
difference in seconds,
|
static |
Describe a range of time in text. Get a short text description of amount of time (delta) e.g. "2h 2m 2s"
|
static |
Full time description. (up to hours) NOT days e.g. "x hours and y minutes and z seconds"
cString Gray::cTimeInt::GetTimeFormStr | ( | const GChar_t * | pszFormat = nullptr , |
TZ_TYPE | nTimeZoneOffset = TZ_LOCAL |
||
) | const |
Get the time as a string formatted using "C" strftime() Opposite of SetTimeStr() MFC just calls this "Format"
StrLen_t Gray::cTimeInt::GetTimeFormStr | ( | GChar_t * | pszOut, |
StrLen_t | iOutSizeMax, | ||
const GChar_t * | pszFormat, | ||
TZ_TYPE | nTimeZoneOffset = TZ_LOCAL |
||
) | const |
MFC just calls this "Format"
|
inline |
Set to time in seconds from time in days. Opposite of cTimeDouble::GetTimeFromSec()
|
inlinestatic |
|
static |
Describe a range of time in text. Get a text description of amount of time (delta)
bool Gray::cTimeInt::GetTimeUnits | ( | OUT cTimeUnits & | rTu, |
TZ_TYPE | nTimeZoneOffset = TZ_UTC |
||
) | const |
Get cTimeUnits for seconds since Jan 1 1970 GMT nTimeZoneOffset = TZ_UTC, TZ_GMT, TZ_LOCAL (adjust for DST and TZ) similar to "::gmtime()" or "::localtime()"
void Gray::cTimeInt::InitTimeNow | ( | ) |
Now();
void Gray::cTimeInt::InitTimeNowPlusSec | ( | TIMESECD_t | iOffsetInSeconds | ) |
|
protected |
Set time in seconds since Jan 1 1970 GMT from cTimeUnits Similar to the MFC CTime::CTime( const FILETIME& ft, int nDST = -1 ) similar to "::mktime()" ASSUME _tzset() has been called and _timezone is set. nTimeZoneOffset = how to deal with DST ? TZ_UTC does not use DST. assume all others do.
|
inline |
|
inline |
MFC does 64 -> 32 bits.
HRESULT Gray::cTimeInt::SetTimeStr | ( | const GChar_t * | pszTimeDate, |
TZ_TYPE | nTimeZoneOffset = TZ_LOCAL |
||
) |
Read the full date format (from Web pages etc) and make it into a cTimeInt value. (local TZ)
|
friend |
The static value for Y2K = January 1, 2000 in UTC/GMT from k_nZero in seconds.