ORE Studio 0.0.4
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
datetime Class Referencefinal

Generates fake datetime values for testing purposes. More...

#include <datetime.hpp>

Collaboration diagram for datetime:
Collaboration graph

Static Public Member Functions

static std::chrono::system_clock::time_point past_timepoint ()
 Generates a random past datetime as a time_point.
 
static std::string past_string ()
 Generates a random past datetime as a formatted string.
 
static std::chrono::system_clock::time_point make_timepoint (int year, int month, int day, int hour=0, int min=0, int sec=0)
 Creates a time_point from date/time components.
 

Detailed Description

Generates fake datetime values for testing purposes.

Member Function Documentation

◆ past_timepoint()

std::chrono::system_clock::time_point past_timepoint ( )
static

Generates a random past datetime as a time_point.

Returns a random datetime between 1970-01-01 and 2038-12-31.

Here is the caller graph for this function:

◆ past_string()

std::string past_string ( )
static

Generates a random past datetime as a formatted string.

Returns a string in the format "YYYY-MM-DD HH:MM:SS".

Here is the caller graph for this function:

◆ make_timepoint()

std::chrono::system_clock::time_point make_timepoint ( int  year,
int  month,
int  day,
int  hour = 0,
int  min = 0,
int  sec = 0 
)
static

Creates a time_point from date/time components.

Uses C++20's timezone-agnostic sys_days for deterministic results across different environments.

Parameters
yearThe year (e.g., 2025)
monthThe month (1-12)
dayThe day (1-31)
hourThe hour (0-23, default 0)
minThe minute (0-59, default 0)
secThe second (0-59, default 0)
Returns
A time_point representing the specified UTC datetime.