bel/common/types/
timestamp.rs1use std::{any::Any, time::SystemTime};
2
3use crate::common::{types::Type, value::Val};
4
5pub struct Timestamp(SystemTime);
6
7impl Val for Timestamp {
8 fn get_type(&self) -> Type<'_> {
9 super::TIMESTAMP_TYPE
10 }
11
12 fn into_inner(self) -> Box<dyn Any> {
13 Box::new(self.0)
14 }
15}
16
17impl From<SystemTime> for Timestamp {
18 fn from(system_time: SystemTime) -> Self {
19 Self(system_time)
20 }
21}
22
23impl From<Timestamp> for SystemTime {
24 fn from(timestamp: Timestamp) -> Self {
25 timestamp.0
26 }
27}