MySQL 8.4.2
Source Code Documentation
my_systime.cc File Reference

Functions for manipulating timespec structs and get_date for converting a time_t to string using various date formats. More...

#include "my_systime.h"
#include "my_config.h"
#include <assert.h>
#include <algorithm>
#include <chrono>
#include <cstdio>
#include <ctime>
#include <limits>
#include <time.h>

Functions

void set_timespec_nsec (struct timespec *abstime, Timeout_type nsec)
 Set the value of a timespec object to the current time plus a number of nanosconds. More...
 
void set_timespec (struct timespec *abstime, Timeout_type sec)
 Set the value of a timespec object to the current time plus a number of seconds using seconds. More...
 
void get_date (char *to, int flag, time_t date)
 Store textual representation of date in a character array. More...
 

Detailed Description

Functions for manipulating timespec structs and get_date for converting a time_t to string using various date formats.

Function Documentation

◆ get_date()

void get_date ( char *  to,
int  flag,
time_t  date 
)

Store textual representation of date in a character array.

Parameters
[out]tocharacter array where date will be written
flagformat of date: If flag & GETDATE_TIME Return date and time If flag & GETDATE_SHORT_DATE Return short date format YYMMDD If flag & GETDATE_HHMMSSTIME Return time in HHMMDD format. If flag & GETDATE_GMT Date/time in GMT If flag & GETDATE_FIXEDLENGTH Return fixed length date/time
datetime_t value for conversion.
Note
If flag & GETDATE_T_DELIMITER Append 'T' between date and time. If flag & GETDATE_SHORT_DATE_FULL_YEAR Return compact date format YYYYMMDD

◆ set_timespec()

void set_timespec ( struct timespec *  abstime,
Timeout_type  sec 
)

Set the value of a timespec object to the current time plus a number of seconds using seconds.

Note
the sec value is capped at std::chrono::seconds::max()
Parameters
[out]abstimetime value being modified
secnumber of seconds to add to current time

◆ set_timespec_nsec()

void set_timespec_nsec ( struct timespec *  abstime,
Timeout_type  nsec 
)

Set the value of a timespec object to the current time plus a number of nanosconds.

Note
the sec value is capped at std::chrono::nanoseconds::max()
Parameters
[out]abstimetime value being modified
nsecnumber of nanoseconds to add to current time