From 0a2cb5093f7fbba370fd9b6caaf308139220b47b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 19 Apr 2011 00:28:08 +0000 Subject: $time_local and $time_utc are locale-independent This doesn't apply to people that use strftime()-formats, but that's a minority. --- lib/clogger/pure.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/clogger/pure.rb') diff --git a/lib/clogger/pure.rb b/lib/clogger/pure.rb index a56b982..63907ae 100644 --- a/lib/clogger/pure.rb +++ b/lib/clogger/pure.rb @@ -137,6 +137,18 @@ private $$.to_s 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)) + 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) else raise "EDOOFUS #{special_nr}" end -- cgit v1.2.3-24-ge0c7