Sha256: aa746ce41f2e5fe5713c43c4e7b8337b2ee697ad04b0d3ec8a2985623b97e9d3
Contents?: true
Size: 680 Bytes
Versions: 3
Compression:
Stored size: 680 Bytes
Contents
# frozen_string_literal: true module Fugit class << self def isostamp(show_date, show_time, show_usec, time) t = time || Time.now s = StringIO.new s << t.strftime('%Y-%m-%d') if show_date s << t.strftime('T%H:%M:%S') if show_time s << sprintf('.%06d', t.usec) if show_time && show_usec s << 'Z' if show_time && time.utc? s.string end def time_to_s(t) isostamp(true, true, false, t) end def time_to_plain_s(t=Time.now, z=true) t.strftime('%Y-%m-%d %H:%M:%S') + (z && t.utc? ? ' Z' : '') end def time_to_zone_s(t=Time.now) t.strftime('%Y-%m-%d %H:%M:%S %Z %z') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fugit-1.4.2 | lib/fugit/misc.rb |
fugit-1.4.1 | lib/fugit/misc.rb |
fugit-1.4.0 | lib/fugit/misc.rb |