git-commit: add Time accessors

Previously, there was no way to access the seconds and offset fields
of the Time type.

Add methods for accessing the fields.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny
2022-12-19 15:54:52 +00:00
parent 79a9472136
commit a65ff27e22
+10
View File
@@ -33,6 +33,16 @@ impl Time {
pub fn new(seconds: i64, offset: i32) -> Self {
Self { seconds, offset }
}
/// Return the time, in seconds, since the epoch.
pub fn seconds(&self) -> i64 {
self.seconds
}
/// Return the timezone offset, in minutes.
pub fn offset(&self) -> i32 {
self.offset
}
}
impl From<Time> for git2::Time {