Skip to content

Commit

Permalink
Merge pull request #4 from jwoertink/crystal_0_27_support
Browse files Browse the repository at this point in the history
update time related methods to be crystal 0.27.0 compatible
  • Loading branch information
akiicat authored Nov 6, 2018
2 parents 77d73f3 + 52c9b88 commit fedf36d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/m3u8/time_item.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module M3U8
# item.empty? # => false
# ```
def empty?
@time.epoch.zero?
@time.to_unix.zero?
end

# ```
Expand All @@ -67,7 +67,7 @@ module M3U8
case time
when String then Time.iso8601(time)
when Time then time
else Time.epoch 0
else Time.unix 0
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions src/patch/time.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ struct Time

def self.iso8601(time : String)
begin
parse(time, "%FT%T.%L%z").to_utc
parse!(time, "%FT%T.%L%z").to_utc
rescue
parse(time, "%FT%T%z").to_utc
parse!(time, "%FT%T%z").to_utc
end
end
end

0 comments on commit fedf36d

Please sign in to comment.