From a65ff27e2226958c3eb1a36b976ae071b8b81e6f Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Mon, 19 Dec 2022 15:54:52 +0000 Subject: [PATCH] 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 X-Clacks-Overhead: GNU Terry Pratchett --- git-commit/src/author.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/git-commit/src/author.rs b/git-commit/src/author.rs index f7fb711..699345e 100644 --- a/git-commit/src/author.rs +++ b/git-commit/src/author.rs @@ -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