diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-01-14 16:20:40 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-01-14 16:21:36 -0800 |
commit | 916e7f09c56ff0ab6722c4cce5e78d71ec336d48 (patch) | |
tree | f05967baca5204ee09ff2e880566a79e4eb5691d /lib | |
parent | fd00bf25c8da9a04952b14bceb7e64420caf9bdb (diff) | |
download | clogger-916e7f09c56ff0ab6722c4cce5e78d71ec336d48.tar.gz |
In case some folks need to use insanely long time formats, we'll support them.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/clogger.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/clogger.rb b/lib/clogger.rb index a64ca09..75a639c 100644 --- a/lib/clogger.rb +++ b/lib/clogger.rb @@ -57,6 +57,7 @@ private \w*))?([^$]*)/x def compile_format(str, opt = {}) + longest_day = Time.at(26265600) # "Saturday, November 01, 1970 00:00:00" rv = [] opt ||= {} str.scan(SCAN).each do |pre,tok,post| @@ -83,9 +84,11 @@ private when /\A\$sent_http_(\w+)\z/ rv << [ OP_RESPONSE, $1.downcase.tr('_','-') ] when /\A\$time_local\{([^\}]+)\}\z/ - rv << [ OP_TIME_LOCAL, $1 ] + fmt = $1 + rv << [ OP_TIME_LOCAL, fmt, longest_day.strftime(fmt) ] when /\A\$time_utc\{([^\}]+)\}\z/ - rv << [ OP_TIME_UTC, $1 ] + fmt = $1 + rv << [ OP_TIME_UTC, fmt, longest_day.strftime(fmt) ] when /\A\$time\{(\d+)\}\z/ rv << [ OP_TIME, *usec_conv_pair(tok, $1.to_i) ] when /\A\$request_time\{(\d+)\}\z/ |