6#include "../datatypes/video_timestamp.hpp"
7#include "../result.hpp"
20 template <
typename TRep,
typename TPeriod>
23 std::chrono::duration_cast<std::chrono::nanoseconds>(time).count();
39 return VideoTimestamp(std::chrono::duration<double, std::milli>(milliseconds));
46 return VideoTimestamp(std::chrono::duration<double, std::milli>(milliseconds));
69 timestamp = timestamp_;
73 VideoTimestamp(int64_t timestamp_ns_) : timestamp(timestamp_ns_) {}
76 timestamp = timestamp_ns_;
92 struct Loggable<components::VideoTimestamp> {
93 static constexpr std::string_view ComponentType =
"rerun.components.VideoTimestamp";
96 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
97 return Loggable<rerun::datatypes::VideoTimestamp>::arrow_datatype();
101 static Result<std::shared_ptr<arrow::Array>> to_arrow(
102 const components::VideoTimestamp* instances,
size_t num_instances
104 if (num_instances == 0) {
105 return Loggable<rerun::datatypes::VideoTimestamp>::to_arrow(
nullptr, 0);
106 }
else if (instances ==
nullptr) {
108 ErrorCode::UnexpectedNullArgument,
109 "Passed array instances is null when num_elements> 0."
112 return Loggable<rerun::datatypes::VideoTimestamp>::to_arrow(
113 &instances->timestamp,
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:99
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:79
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Component: Timestamp inside a archetypes::AssetVideo.
Definition video_timestamp.hpp:15
static VideoTimestamp from_milliseconds(double milliseconds)
Creates a new VideoTimestamp from a presentation timestamp in milliseconds.
Definition video_timestamp.hpp:43
static VideoTimestamp from_millis(double milliseconds)
Creates a new VideoTimestamp from a presentation timestamp in milliseconds.
Definition video_timestamp.hpp:38
static VideoTimestamp from_nanos(int64_t nanoseconds)
Creates a new VideoTimestamp from a presentation timestamp in nanoseconds.
Definition video_timestamp.hpp:50
static VideoTimestamp from_seconds(double seconds)
Creates a new VideoTimestamp from a presentation timestamp in seconds.
Definition video_timestamp.hpp:32
static VideoTimestamp from_nanoseconds(int64_t nanoseconds)
Creates a new VideoTimestamp from a presentation timestamp in nanoseconds.
Definition video_timestamp.hpp:55
VideoTimestamp(std::chrono::duration< TRep, TPeriod > time)
Creates a new VideoTimestamp from a presentation timestamp as a chrono duration.
Definition video_timestamp.hpp:21
static VideoTimestamp from_secs(double seconds)
Creates a new VideoTimestamp from a presentation timestamp in seconds.
Definition video_timestamp.hpp:27
Datatype: Presentation timestamp within a archetypes::AssetVideo.
Definition video_timestamp.hpp:27
int64_t timestamp_ns
Presentation timestamp value in nanoseconds.
Definition video_timestamp.hpp:29