Represents a timestamp composed of a date and a time encoded in a time_t value. Provides ways of getting the current time and to format the time in a string. More...
#include <DateTime.h>
Public Member Functions | |
DateTime () | |
Default constructor. | |
DateTime (time_t _timestamp) | |
Constructor that takes a time_t. | |
DateTime (const DateTime &e) | |
Copy constructor. Construct from another DateTime. | |
DateTime & | operator= (const DateTime &e) |
Copy operator. Copy from another DateTime. | |
std::string | ToString () |
Format the DateTime as a string. The format is "standard" (in this case, preset to 02/22/2023 10:26:12 AM, local time). | |
Static Public Member Functions | |
static DateTime | Now () |
Return the current date and time. | |
Private Attributes | |
time_t | timestamp |
Represents a timestamp composed of a date and a time encoded in a time_t value. Provides ways of getting the current time and to format the time in a string.
Definition at line 20 of file lusplus/helpers/DateTime.h.
|
inline |
Default constructor.
Definition at line 29 of file lusplus/helpers/DateTime.h.
Referenced by DateTime::Now().
|
inline |
Constructor that takes a time_t.
_timestamp | The time to use in this DateTime. |
Definition at line 37 of file lusplus/helpers/DateTime.h.
Copy constructor. Construct from another DateTime.
e | Another DateTime object. |
Definition at line 42 of file lusplus/helpers/DateTime.h.
|
static |
Return the current date and time.
Definition at line 35 of file DateTime.cpp.
References DateTime::DateTime().
Copy operator. Copy from another DateTime.
e | Another DateTime object. |
Definition at line 48 of file lusplus/helpers/DateTime.h.
References DateTime::timestamp.
std::string ToString | ( | ) |
Format the DateTime as a string. The format is "standard" (in this case, preset to 02/22/2023 10:26:12 AM, local time).
Definition at line 17 of file DateTime.cpp.
References Helpers::makelocaltime(), and DateTime::timestamp.
|
private |
Definition at line 23 of file lusplus/helpers/DateTime.h.
Referenced by DateTime::operator=(), and DateTime::ToString().