mirror of
https://github.com/gosticks/SwiftGit2.git
synced 2025-10-16 11:55:34 +00:00
Replace NSTimeZone with TimeZone
This commit is contained in:
parent
b6c3c795bc
commit
003464dde8
@ -35,14 +35,14 @@ public struct Signature {
|
||||
public let time: Date
|
||||
|
||||
/// The time zone that `time` should be interpreted relative to.
|
||||
public let timeZone: NSTimeZone
|
||||
public let timeZone: TimeZone
|
||||
|
||||
/// Create an instance with a libgit2 `git_signature`.
|
||||
public init(_ signature: git_signature) {
|
||||
name = String(validatingUTF8: signature.name)!
|
||||
email = String(validatingUTF8: signature.email)!
|
||||
time = Date(timeIntervalSince1970: TimeInterval(signature.when.time))
|
||||
timeZone = NSTimeZone(forSecondsFromGMT: NSInteger(60 * signature.when.offset))
|
||||
timeZone = TimeZone(secondsFromGMT: 60 * Int(signature.when.offset))!
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public func == (lhs: Signature, rhs: Signature) -> Bool {
|
||||
return lhs.name == rhs.name
|
||||
&& lhs.email == rhs.email
|
||||
&& lhs.time == rhs.time
|
||||
&& lhs.timeZone.secondsFromGMT == rhs.timeZone.secondsFromGMT
|
||||
&& lhs.timeZone == rhs.timeZone
|
||||
}
|
||||
|
||||
/// A git commit.
|
||||
|
||||
@ -37,7 +37,7 @@ class SignatureSpec: QuickSpec {
|
||||
expect(signature.name).to(equal("Matt Diephouse"))
|
||||
expect(signature.email).to(equal("matt@diephouse.com"))
|
||||
expect(signature.time).to(equal(Date(timeIntervalSince1970: 1416186947)))
|
||||
expect(signature.timeZone.abbreviation).to(equal("GMT-5"))
|
||||
expect(signature.timeZone.abbreviation()).to(equal("GMT-5"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user