Permalink
Browse files

100% Git-compliant actor creation

Some more tweaks here:

	- Do not use `strftime`, because it's not assured
	to be cross-platform

	- Use C-like string formatting for Great Glory
	When Printing Numbers.

	- Always print an email address -- even if we don't
	have one. A missing email field will crash `fsck`.
  • Loading branch information...
1 parent e33fad9 commit ff015074ef35bd94cba943f9c0f98e161ab5851c @vmg vmg committed Aug 20, 2011
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/grit/actor.rb
View
@@ -34,11 +34,13 @@ def self.from_string(str)
#
# Returns a String.
def output(time)
- out = @name.to_s.dup
- if @email
- out << " <#{@email}>"
- end
- out << time.strftime(" %s %z")
+ offset = time.utc_offset / 60
+ "%s <%s> %d %+.2d%.2d" % [
+ @name,
+ @email || "null",
+ time.to_i,
+ offset / 60,
+ offset.abs % 60]
end
# Pretty object inspection

0 comments on commit ff01507

Please sign in to comment.