Struct DuckDbTimestamp
DuckDB's representation of a timestamp.
Inherited Members
Namespace: Mallard.Types
Assembly: Mallard.dll
Syntax
public struct DuckDbTimestamp
Remarks
This type exists mainly to enable date/time values reported by DuckDB to be read directly from the memory of a DuckDB vector. The fields are not wrapped in properties to allow vectorized processing (i.e. SIMD), and DuckDB already essentially guarantees a stable layout of this structure.
Constructors
| Edit this page View SourceDuckDbTimestamp(long)
DuckDB's representation of a timestamp.
Declaration
public DuckDbTimestamp(long microseconds)
Parameters
Type | Name | Description |
---|---|---|
long | microseconds | The timestamp value represented as the number of microseconds since the Unix epoch (January 1, 1970, 00:00:00 UTC). |
Remarks
This type exists mainly to enable date/time values reported by DuckDB to be read directly from the memory of a DuckDB vector. The fields are not wrapped in properties to allow vectorized processing (i.e. SIMD), and DuckDB already essentially guarantees a stable layout of this structure.
Fields
| Edit this page View SourceMicroseconds
Number of microseconds elapsed since midnight 1970-01-01 (Unix epoch).
Declaration
public long Microseconds
Field Value
Type | Description |
---|---|
long |
Methods
| Edit this page View SourceFromDateTime(DateTime, bool)
Convert from a standard DateTime.
Declaration
public static DuckDbTimestamp FromDateTime(DateTime dateTime, bool exact = true)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime | Desired date/time to represent in DuckDB. |
bool | exact | If true, fail if |
Returns
Type | Description |
---|---|
DuckDbTimestamp | The DuckDB representation of the date/time. |
Exceptions
Type | Condition |
---|---|
ArgumentException | There are fractional microseconds and |
ToDateTime()
Convert to a standard DateTime.
Declaration
public readonly DateTime ToDateTime()
Returns
Type | Description |
---|---|
DateTime | The DateTime instance that represents the same point in time as this DuckDB timestamp. Its DateTimeKind will be set to Unspecified. |
Exceptions
Type | Condition |
---|---|
OverflowException | When this DuckDB timestamp cannot be represented in an instance of DateTime, because the time point exists earlier than (underflows) MinValue or later than (overflows) MaxValue. (DateTime has finer resolution than microseconds, so the conversion is always exact if there is no does not overflow or underflow.) |