summaryrefslogtreecommitdiff
path: root/src/datetime.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/datetime.rs')
-rw-r--r--src/datetime.rs61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/datetime.rs b/src/datetime.rs
new file mode 100644
index 0000000..54685ec
--- /dev/null
+++ b/src/datetime.rs
@@ -0,0 +1,61 @@
+use crate::{Date, Month, Time, Year};
+
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub struct NaiveDateTime {
+ date: Date,
+ time: Time,
+}
+
+impl NaiveDateTime {
+ // TODO docs
+
+ pub const fn new(date: Date, time: Time) -> Self {
+ Self { date, time }
+ }
+
+ pub const fn date(self) -> Date {
+ self.date
+ }
+
+ pub const fn time(self) -> Time {
+ self.time
+ }
+
+ pub const fn year(self) -> Year {
+ self.date.year()
+ }
+
+ pub const fn month(self) -> Month {
+ self.date.month()
+ }
+
+ pub const fn day(self) -> u8 {
+ self.date.day()
+ }
+
+ pub const fn hour(self) -> u8 {
+ self.time.hour()
+ }
+
+ pub const fn minute(self) -> u8 {
+ self.time.minute()
+ }
+
+ pub const fn second(self) -> u8 {
+ self.time.second()
+ }
+
+ pub const fn millisecond(self) -> u16 {
+ self.time.millisecond()
+ }
+
+ pub const fn microsecond(self) -> u32 {
+ self.time.microsecond()
+ }
+
+ pub const fn nanosecond(self) -> u32 {
+ self.time.nanosecond()
+ }
+}
+
+// TODO addition