Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

Commit

Permalink
Merge b89401a into a0fbb88
Browse files Browse the repository at this point in the history
  • Loading branch information
scouten committed Oct 12, 2019
2 parents a0fbb88 + b89401a commit 4b2c138
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/xgit/core/person_ident.ex
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ defmodule Xgit.Core.PersonIdent do
case {time, tz} do
{[_ | _], [_ | _]} ->
{time |> ParseDecimal.from_decimal_charlist() |> elem(0),
tz |> RawParseUtils.parse_timezone_offset() |> elem(0)}
tz |> parse_timezone_offset() |> elem(0)}

_ ->
cover {0, 0}
Expand All @@ -162,7 +162,16 @@ defmodule Xgit.Core.PersonIdent do
|> Enum.take_while(&(&1 != ?\s))
|> Enum.reverse()

{word, Enum.drop(rev, Enum.count(word))}
cover {word, Enum.drop(rev, Enum.count(word))}
end

defp parse_timezone_offset(b) do
{v, b} = ParseDecimal.from_decimal_charlist(b)

tz_min = rem(v, 100)
tz_hour = div(v, 100)

cover {tz_hour * 60 + tz_min, b}
end

@doc ~S"""
Expand Down

0 comments on commit 4b2c138

Please sign in to comment.