added DateTime::gmtNow()
This commit is contained in:
parent
af5b879506
commit
2e6a8dc6a8
|
@ -36,20 +36,32 @@ inline bool inRangeExclMax(num1 val, num2 min, num3 max)
|
|||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.
|
||||
* \brief Returns a DateTime object that is set to the current date and time on this computer, expressed as the local time.
|
||||
*/
|
||||
DateTime DateTime::now()
|
||||
{
|
||||
return DateTime::fromTimeStamp(time(nullptr));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns a DateTime object that is set to the current date and time on this computer, expressed as the GMT time.
|
||||
*/
|
||||
DateTime DateTime::gmtNow()
|
||||
{
|
||||
return DateTime::fromTimeStampGmt(time(nullptr));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \class ChronoUtilities::DateTime
|
||||
* \brief Represents an instant in time, typically expressed as a date and time of day.
|
||||
* \remarks Time values are measured in 100-nanosecond units called ticks,
|
||||
* and a particular date is the number of ticks since 12:00 midnight, January 1,
|
||||
* 0001 A.D. (C.E.) in the GregorianCalendar calendar (excluding ticks that would
|
||||
* be added by leap seconds).
|
||||
* \remarks
|
||||
* - Time values are measured in 100-nanosecond units called ticks,
|
||||
* and a particular date is the number of ticks since 12:00 midnight, January 1,
|
||||
* 0001 A.D. (C.E.) in the GregorianCalendar calendar (excluding ticks that would
|
||||
* be added by leap seconds).
|
||||
* - There is no time zone information associated. Hence different time zones are
|
||||
* not taken into account when comparing two instances. For instance the
|
||||
* expression (DateTime::now() - DateTime::gmtNow()) returns one hour in Germany (instead of zero).
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
|
|
@ -84,6 +84,7 @@ public:
|
|||
|
||||
static constexpr DateTime eternity();
|
||||
static DateTime now();
|
||||
static DateTime gmtNow();
|
||||
constexpr static bool isLeapYear(int year);
|
||||
static int daysInMonth(int year, int month);
|
||||
|
||||
|
|
Loading…
Reference in New Issue