about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/clogger/pure.rb13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/clogger/pure.rb b/lib/clogger/pure.rb
index 7f82992..4b38e90 100644
--- a/lib/clogger/pure.rb
+++ b/lib/clogger/pure.rb
@@ -133,17 +133,10 @@ private
     when :time_iso8601
       Time.now.iso8601
     when :time_local
-      t = Time.now
-      off = t.utc_offset
-      sign = off < 0 ? '-' : '+'
-      sprintf("%02d/%s/%d:%02d:%02d:%02d #{sign}%02d%02d",
-              t.mday, Time::RFC2822_MONTH_NAME[t.mon - 1],
-              t.year, t.hour, t.min, t.sec, *(off.abs / 60).divmod(60))
+      # %b in Ruby is locale-independent, unlike strftime(3) in C
+      Time.now.strftime('%d/%b/%Y:%H:%M:%S %z')
     when :time_utc
-      t = Time.now.utc
-      sprintf("%02d/%s/%d:%02d:%02d:%02d +0000",
-              t.mday, Time::RFC2822_MONTH_NAME[t.mon - 1],
-              t.year, t.hour, t.min, t.sec)
+      Time.now.utc.strftime('%d/%b/%Y:%H:%M:%S %z')
     else
       raise "EDOOFUS #{special_nr}"
     end