Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::Timestamp Class Reference

The static Timestamp class holds helper functions for the timestamp types. More...

#include <duckdb.hpp>

Static Public Member Functions

static DUCKDB_API timestamp_t FromString (const string &str, bool use_offset)
 Convert a string in the format "YYYY-MM-DD hh:mm:ss[.f][-+TH[:tm]]" to a timestamp object.
 
static DUCKDB_API TimestampCastResult TryConvertTimestampTZ (const char *str, idx_t len, timestamp_t &result, const bool use_offset, bool &has_offset, string_t &tz, optional_ptr< int32_t > nanos=nullptr)
 
static DUCKDB_API TimestampCastResult TryConvertTimestamp (const char *str, idx_t len, timestamp_t &result, const bool use_offset, optional_ptr< int32_t > nanos=nullptr, bool strict=false)
 Strict Timestamp does not accept offsets.
 
static DUCKDB_API TimestampCastResult TryConvertTimestamp (const char *str, idx_t len, timestamp_ns_t &result)
 
static DUCKDB_API timestamp_t FromCString (const char *str, idx_t len, bool use_offset=false, optional_ptr< int32_t > nanos=nullptr)
 
static DUCKDB_API string ToString (timestamp_t timestamp)
 Convert a date object to a string in the format "YYYY-MM-DD hh:mm:ss".
 
static DUCKDB_API date_t GetDate (timestamp_t timestamp)
 
static DUCKDB_API dtime_t GetTime (timestamp_t timestamp)
 
static DUCKDB_API dtime_ns_t GetTimeNs (timestamp_ns_t timestamp)
 
static DUCKDB_API timestamp_t FromDatetime (date_t date, dtime_t time)
 Create a Timestamp object from a specified (date, time) combination.
 
static DUCKDB_API bool TryFromDatetime (date_t date, dtime_t time, timestamp_t &result)
 
static DUCKDB_API bool TryFromDatetime (date_t date, dtime_tz_t timetz, timestamp_t &result)
 
static DUCKDB_API bool TryFromTimestampNanos (timestamp_t ts, int32_t nanos, timestamp_ns_t &result)
 Scale up to ns.
 
static bool CharacterIsTimeZone (char c)
 Is the character a valid part of a time zone name?
 
static bool IsFinite (timestamp_t timestamp)
 True, if the timestamp is finite, else false.
 
static DUCKDB_API void Convert (timestamp_t date, date_t &out_date, dtime_t &out_time)
 Extract the date and time from a given timestamp object.
 
static DUCKDB_API void Convert (timestamp_ns_t date, date_t &out_date, dtime_t &out_time, int32_t &out_nanos)
 Extract the date and time from a given timestamp object.
 
static DUCKDB_API timestamp_t GetCurrentTimestamp ()
 Returns current timestamp.
 
static DUCKDB_API timestamp_t FromEpochSecondsPossiblyInfinite (int64_t s)
 Convert the epoch (in sec) to a timestamp.
 
static DUCKDB_API timestamp_t FromEpochSeconds (int64_t s)
 
static DUCKDB_API timestamp_t FromEpochMsPossiblyInfinite (int64_t ms)
 Convert the epoch (in ms) to a timestamp.
 
static DUCKDB_API timestamp_t FromEpochMs (int64_t ms)
 
static DUCKDB_API timestamp_t FromEpochMicroSeconds (int64_t micros)
 Convert the epoch (in microseconds) to a timestamp.
 
static DUCKDB_API timestamp_t FromEpochNanoSecondsPossiblyInfinite (int64_t nanos)
 Convert the epoch (in nanoseconds) to a timestamp.
 
static DUCKDB_API timestamp_t FromEpochNanoSeconds (int64_t nanos)
 
static DUCKDB_API timestamp_ns_t TimestampNsFromEpochMicros (int64_t micros)
 Construct ns timestamps from various epoch units.
 
static DUCKDB_API timestamp_ns_t TimestampNsFromEpochMillis (int64_t millis)
 
static DUCKDB_API bool TryGetEpochNanoSeconds (timestamp_t timestamp, int64_t &result)
 Try convert a timestamp to epoch (in nanoseconds)
 
static DUCKDB_API int64_t GetEpochSeconds (timestamp_t timestamp)
 Convert the epoch (in seconds) to a timestamp.
 
static DUCKDB_API int64_t GetEpochMs (timestamp_t timestamp)
 Convert the epoch (in ms) to a timestamp.
 
static DUCKDB_API int64_t GetEpochMicroSeconds (timestamp_t timestamp)
 Convert a timestamp to epoch (in microseconds)
 
static DUCKDB_API int64_t GetEpochNanoSeconds (timestamp_t timestamp)
 Convert a timestamp to epoch (in nanoseconds)
 
static DUCKDB_API int64_t GetEpochNanoSeconds (timestamp_ns_t timestamp)
 
static DUCKDB_API int64_t GetEpochRounded (timestamp_t timestamp, const int64_t power_of_ten)
 Convert a timestamp to a rounded epoch at a given resolution.
 
static DUCKDB_API double GetJulianDay (timestamp_t timestamp)
 Convert a timestamp to a Julian Day.
 
static DUCKDB_API TimestampComponents GetComponents (timestamp_t timestamp)
 Decompose a timestamp into its components.
 
static DUCKDB_API time_t ToTimeT (timestamp_t)
 
static DUCKDB_API timestamp_t FromTimeT (time_t)
 
static DUCKDB_API bool TryParseUTCOffset (const char *str, idx_t &pos, idx_t len, int &hh, int &mm, int &ss)
 
static DUCKDB_API string FormatError (const string &str)
 
static DUCKDB_API string FormatError (string_t str)
 
static DUCKDB_API string UnsupportedTimezoneError (const string &str)
 
static DUCKDB_API string UnsupportedTimezoneError (string_t str)
 
static DUCKDB_API string RangeError (const string &str)
 
static DUCKDB_API string RangeError (string_t str)
 

Static Public Attributes

static constexpr const int32_t MIN_YEAR = -290308
 
static constexpr const int32_t MIN_MONTH = 12
 
static constexpr const int32_t MIN_DAY = 22
 

Detailed Description

The static Timestamp class holds helper functions for the timestamp types.

Member Function Documentation

◆ TryConvertTimestampTZ()

static DUCKDB_API TimestampCastResult duckdb::Timestamp::TryConvertTimestampTZ ( const char str,
idx_t  len,
timestamp_t result,
const bool  use_offset,
bool &  has_offset,
string_t tz,
optional_ptr< int32_t nanos = nullptr 
)
static

Convert a string where the offset can also be a time zone string: / [A_Za-z0-9/_]+/ If has_offset is true, then the result is an instant that was offset from UTC If the tz is not empty, the result is still an instant, but the parts can be extracted and applied to the TZ

◆ CharacterIsTimeZone()

static bool duckdb::Timestamp::CharacterIsTimeZone ( char  c)
inlinestatic

Is the character a valid part of a time zone name?

4281 {
4282 return StringUtil::CharacterIsAlpha(c) || StringUtil::CharacterIsDigit(c) || c == '_' || c == '/' || c == '+' ||
4283 c == '-';
4284 }

◆ IsFinite()

static bool duckdb::Timestamp::IsFinite ( timestamp_t  timestamp)
inlinestatic

True, if the timestamp is finite, else false.

4287 {
4288 return timestamp != timestamp_t::infinity() && timestamp != timestamp_t::ninfinity();
4289 }
cv::GOpaque< int64_t > timestamp(G g)
Here is the call graph for this function:

The documentation for this class was generated from the following file: