public
Fork of Caged/gitnub
Description: A Gitk-like application written in RubyCocoa that looks like it belongs on a Mac. See the wiki for downloads and screenshots.
Homepage: http://alternateidea.com
Clone URL: git://github.com/cypher/gitnub.git
gitnub / lib / time_extensions.rb
100644 14 lines (14 sloc) 0.445 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Time
  def to_system_time(style = :full)
    formatter = OSX::NSDateFormatter.alloc.init
    case style
      when :full
        formatter.dateStyle = OSX::NSDateFormatterMediumStyle
        formatter.timeStyle = OSX::NSDateFormatterShortStyle
      when :time
        formatter.dateStyle = OSX::NSDateFormatterNoStyle
        formatter.timeStyle = OSX::NSDateFormatterShortStyle
    end
    formatter.stringFromDate(self.to_ns)
  end
end