Skip to content

Commit

Permalink
Add to_pdu() method to TimeDate struct
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdewid committed Feb 7, 2024
1 parent 5053e35 commit 3518bfc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/spn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,17 @@ impl TimeDate {
second: (pdu[0] as f32 * 0.25) as u32,
}
}

pub fn to_pdu(&self) -> [u8; 8] {
[
(self.second * 4) as u8,
self.minute as u8,
self.hour as u8,
self.month as u8,
(self.day * 4) as u8,
(self.year - 1985) as u8,
0xff,
0xff,
]
}
}

0 comments on commit 3518bfc

Please sign in to comment.