mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-10-26 06:40:42 +08:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user