Main MRPT website > C++ reference
MRPT logo
Classes | Typedefs | Functions
Time and date functions (in #include <mrpt/system/datetime.h>)

Detailed Description

Collaboration diagram for Time and date functions (in #include <mrpt/system/datetime.h>):

Classes

struct  mrpt::system::TTimeParts
 The parts of a date/time (it's like the standard 'tm' but with fractions of seconds). More...
 

Typedefs

typedef uint64_t mrpt::system::TTimeStamp
 A system independent time type, it holds the the number of 100-nanosecond intervals since January 1, 1601 (UTC). More...
 

Functions

mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::buildTimestampFromParts (const mrpt::system::TTimeParts &p)
 Builds a timestamp from the parts (Parts are in UTC) More...
 
mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::buildTimestampFromPartsLocalTime (const mrpt::system::TTimeParts &p)
 Builds a timestamp from the parts (Parts are in local time) More...
 
void BASE_IMPEXP mrpt::system::timestampToParts (TTimeStamp t, TTimeParts &p, bool localTime=false)
 Gets the individual parts of a date/time (days, hours, minutes, seconds) - UTC time or local time. More...
 
mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::getCurrentTime ()
 Returns the current (UTC) system time. More...
 
mrpt::system::TTimeStamp mrpt::system::now ()
 A shortcut for system::getCurrentTime. More...
 
mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::getCurrentLocalTime ()
 Returns the current (local) time. More...
 
mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::time_tToTimestamp (const double &t)
 Transform from standard "time_t" (actually a double number, it can contain fractions of seconds) to TTimeStamp. More...
 
mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::time_tToTimestamp (const time_t &t)
 Transform from standard "time_t" to TTimeStamp. More...
 
double BASE_IMPEXP mrpt::system::timestampTotime_t (const mrpt::system::TTimeStamp &t)
 Transform from TTimeStamp to standard "time_t" (actually a double number, it can contain fractions of seconds). More...
 
double mrpt::system::timestampToDouble (const mrpt::system::TTimeStamp &t)
 Transform from TTimeStamp to standard "time_t" (actually a double number, it can contain fractions of seconds). More...
 
double BASE_IMPEXP mrpt::system::timeDifference (const mrpt::system::TTimeStamp &t_first, const mrpt::system::TTimeStamp &t_later)
 Retuns the time difference from t1 to t2 (positive if t2 is posterior to t1), in seconds. More...
 
mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::secondsToTimestamp (const double &nSeconds)
 Transform a time interval (in seconds) into TTimeStamp (e.g. More...
 
std::string BASE_IMPEXP mrpt::system::formatTimeInterval (const double &timeSeconds)
 Returns a formated string with the given time difference (passed as the number of seconds), as a string [H]H:MM:SS.MILISECS. More...
 
std::string BASE_IMPEXP mrpt::system::dateTimeToString (const mrpt::system::TTimeStamp &t)
 Convert a timestamp into this textual form (UTC time): YEAR/MONTH/DAY,HH:MM:SS.MMM. More...
 
std::string BASE_IMPEXP mrpt::system::dateTimeLocalToString (const mrpt::system::TTimeStamp &t)
 Convert a timestamp into this textual form (in local time): YEAR/MONTH/DAY,HH:MM:SS.MMM. More...
 
std::string BASE_IMPEXP mrpt::system::dateToString (const mrpt::system::TTimeStamp &t)
 Convert a timestamp into this textual form: YEAR/MONTH/DAY. More...
 
double BASE_IMPEXP mrpt::system::extractDayTimeFromTimestamp (const mrpt::system::TTimeStamp &t)
 Returns the number of seconds ellapsed from midnight in the given timestamp. More...
 
std::string BASE_IMPEXP mrpt::system::timeToString (const mrpt::system::TTimeStamp &t)
 Convert a timestamp into this textual form (UTC): HH:MM:SS.MMMMMM. More...
 
std::string BASE_IMPEXP mrpt::system::timeLocalToString (const mrpt::system::TTimeStamp &t, unsigned int secondFractionDigits=6)
 Convert a timestamp into this textual form (in local time): HH:MM:SS.MMMMMM. More...
 
std::string BASE_IMPEXP mrpt::system::intervalFormat (const double seconds)
 This function implements time interval formatting: Given a time in seconds, it will return a string describing the interval with the most appropriate unit. More...
 

Typedef Documentation

◆ TTimeStamp

typedef uint64_t mrpt::system::TTimeStamp

A system independent time type, it holds the the number of 100-nanosecond intervals since January 1, 1601 (UTC).

See also
system::getCurrentTime, system::timeDifference, INVALID_TIMESTAMP, TTimeParts

Definition at line 54 of file datetime.h.

Function Documentation

◆ buildTimestampFromParts()

mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::buildTimestampFromParts ( const mrpt::system::TTimeParts p)

Builds a timestamp from the parts (Parts are in UTC)

See also
timestampToParts

◆ buildTimestampFromPartsLocalTime()

mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::buildTimestampFromPartsLocalTime ( const mrpt::system::TTimeParts p)

Builds a timestamp from the parts (Parts are in local time)

See also
timestampToParts, buildTimestampFromParts

◆ dateTimeLocalToString()

std::string BASE_IMPEXP mrpt::system::dateTimeLocalToString ( const mrpt::system::TTimeStamp t)

Convert a timestamp into this textual form (in local time): YEAR/MONTH/DAY,HH:MM:SS.MMM.

See also
dateTimeToString

◆ dateTimeToString()

std::string BASE_IMPEXP mrpt::system::dateTimeToString ( const mrpt::system::TTimeStamp t)

Convert a timestamp into this textual form (UTC time): YEAR/MONTH/DAY,HH:MM:SS.MMM.

See also
dateTimeLocalToString

◆ dateToString()

std::string BASE_IMPEXP mrpt::system::dateToString ( const mrpt::system::TTimeStamp t)

Convert a timestamp into this textual form: YEAR/MONTH/DAY.

◆ extractDayTimeFromTimestamp()

double BASE_IMPEXP mrpt::system::extractDayTimeFromTimestamp ( const mrpt::system::TTimeStamp t)

Returns the number of seconds ellapsed from midnight in the given timestamp.

◆ formatTimeInterval()

std::string BASE_IMPEXP mrpt::system::formatTimeInterval ( const double &  timeSeconds)

Returns a formated string with the given time difference (passed as the number of seconds), as a string [H]H:MM:SS.MILISECS.

See also
unitsFormat

◆ getCurrentLocalTime()

mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::getCurrentLocalTime ( )

Returns the current (local) time.

See also
now,getCurrentTime

◆ getCurrentTime()

mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::getCurrentTime ( )

Returns the current (UTC) system time.

See also
now,getCurrentLocalTime

Referenced by mrpt::system::now().

◆ intervalFormat()

std::string BASE_IMPEXP mrpt::system::intervalFormat ( const double  seconds)

This function implements time interval formatting: Given a time in seconds, it will return a string describing the interval with the most appropriate unit.

E.g.: 1.23 year, 3.50 days, 9.3 hours, 5.3 minutes, 3.34 sec, 178.1 ms, 87.1 us.

See also
unitsFormat

◆ now()

mrpt::system::TTimeStamp mrpt::system::now ( )
inline

A shortcut for system::getCurrentTime.

See also
getCurrentTime, getCurrentLocalTime

Definition at line 94 of file datetime.h.

References mrpt::system::getCurrentTime().

◆ secondsToTimestamp()

mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::secondsToTimestamp ( const double &  nSeconds)

Transform a time interval (in seconds) into TTimeStamp (e.g.

which can be added to an existing valid timestamp)

See also
timeDifference

◆ time_tToTimestamp() [1/2]

mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::time_tToTimestamp ( const double &  t)

Transform from standard "time_t" (actually a double number, it can contain fractions of seconds) to TTimeStamp.

See also
timestampTotime_t

◆ time_tToTimestamp() [2/2]

mrpt::system::TTimeStamp BASE_IMPEXP mrpt::system::time_tToTimestamp ( const time_t &  t)

Transform from standard "time_t" to TTimeStamp.

See also
timestampTotime_t

◆ timeDifference()

double BASE_IMPEXP mrpt::system::timeDifference ( const mrpt::system::TTimeStamp t_first,
const mrpt::system::TTimeStamp t_later 
)

Retuns the time difference from t1 to t2 (positive if t2 is posterior to t1), in seconds.

See also
secondsToTimestamp

◆ timeLocalToString()

std::string BASE_IMPEXP mrpt::system::timeLocalToString ( const mrpt::system::TTimeStamp t,
unsigned int  secondFractionDigits = 6 
)

Convert a timestamp into this textual form (in local time): HH:MM:SS.MMMMMM.

◆ timestampToDouble()

double mrpt::system::timestampToDouble ( const mrpt::system::TTimeStamp t)
inline

Transform from TTimeStamp to standard "time_t" (actually a double number, it can contain fractions of seconds).

This function is just an (inline) alias of timestampTotime_t(), with a more significant name.

See also
time_tToTimestamp, secondsToTimestamp

Definition at line 122 of file datetime.h.

References t(), and mrpt::system::timestampTotime_t().

◆ timestampToParts()

void BASE_IMPEXP mrpt::system::timestampToParts ( TTimeStamp  t,
TTimeParts p,
bool  localTime = false 
)

Gets the individual parts of a date/time (days, hours, minutes, seconds) - UTC time or local time.

See also
buildTimestampFromParts

◆ timestampTotime_t()

double BASE_IMPEXP mrpt::system::timestampTotime_t ( const mrpt::system::TTimeStamp t)

Transform from TTimeStamp to standard "time_t" (actually a double number, it can contain fractions of seconds).

See also
time_tToTimestamp, secondsToTimestamp

Referenced by mrpt::system::timestampToDouble().

◆ timeToString()

std::string BASE_IMPEXP mrpt::system::timeToString ( const mrpt::system::TTimeStamp t)

Convert a timestamp into this textual form (UTC): HH:MM:SS.MMMMMM.




Page generated by Doxygen 1.8.14 for MRPT 1.0.2 SVN: at lun oct 28 00:52:41 CET 2019 Hosted on:
SourceForge.net Logo