[#9331] initialize arguments — WATANABE Hirofumi <Hirofumi.Watanabe@...>
わたなべです.
10 messages
2000/03/01
[#9332] Re: initialize arguments
— WATANABE Tetsuya <tetsu@...>
2000/03/01
渡辺哲也です。
[#9377] Hash.new('') — WATANABE Tetsuya <tetsu@...>
渡辺哲也です。
11 messages
2000/03/06
[#9383] rb_call_super() — Yasushi Shoji <yashi@...>
やすしです。
10 messages
2000/03/06
[#9388] Re: rb_call_super()
— Kazuhiro HIWADA <hiwada@...>
2000/03/07
ひわだです。
[#9395] Re: rb_call_super()
— matz@... (Yukihiro Matsumoto)
2000/03/07
まつもと ゆきひろです
[#9398] Re: rb_call_super()
— Yasushi Shoji <yashi@...>
2000/03/07
やすしです。
[#9393] [PATCH] Symbol.new — nobu.nakada@...
なかだです。
13 messages
2000/03/07
[#9396] Re: [PATCH] Symbol.new
— matz@... (Yukihiro Matsumoto)
2000/03/07
まつもと ゆきひろです
[#9424] method_missing(Fixnum) — nobu.nakada@...
なかだです。
5 messages
2000/03/11
[#9430] [BUG] Process.kill :symbol, pid — Koji Arai <JCA02266@...>
新井です。
5 messages
2000/03/12
[#9445] thread.rb — m_seki@...
18 messages
2000/03/16
[#9446] Re: thread.rb
— matz@... (Yukihiro Matsumoto)
2000/03/17
[#9460] Re: thread.rb
— m_seki@...
2000/03/21
[#9462] Re: thread.rb
— matz@... (Yukihiro Matsumoto)
2000/03/21
まつもと ゆきひろです
[#11281] Re: thread.rb
— Masatoshi SEKI <m_seki@...>
2000/10/22
[#11282] Re: thread.rb
— Yasushi Shoji <yashi@...>
2000/10/22
At Mon, 23 Oct 2000 00:14:30 +0900,
[#11283] Re: thread.rb
— Masatoshi SEKI <m_seki@...>
2000/10/22
[#11284] Re: thread.rb
— Yasushi Shoji <yashi@...>
2000/10/22
At Mon, 23 Oct 2000 01:40:14 +0900,
[#11288] sync/async message passing model (was Re: Re: thread.rb)
— kjana@... (YANAGAWA Kazuhisa)
2000/10/23
In message <20001022171627N.yashi@yashi.com>
[#11291] Re: sync/async message passing model (was Re: Re: thread.rb)
— kjana@... (YANAGAWA Kazuhisa)
2000/10/24
追加,追加.
[#9447] ParseDate.parsedate( "2000-03-16T23:45:54+0900" ) — "NAKAMURA, Hiroshi" <nakahiro@...>
なひです.
10 messages
2000/03/17
[#9448] Re: ParseDate.parsedate( "2000-03-16T23:45:54+0900" )
— Tadayoshi Funaba <tadf@...>
2000/03/17
ふなばです。
[#9449] Re: ParseDate.parsedate( "2000-03-16T23:45:54+0900" )
— matz@... (Yukihiro Matsumoto)
2000/03/18
まつもと ゆきひろです
[#9451] Re: ParseDate.parsedate( "2000-03-16T23:45:54+0900" )
— Tadayoshi Funaba <tadf@...>
2000/03/18
ふなばです。
[#9473] Symbol#<=> — Koji Arai <JCA02266@...>
新井です。
12 messages
2000/03/23
[#9477] Re: Symbol#<=>
— matz@... (Yukihiro Matsumoto)
2000/03/24
まつもと ゆきひろです
[#9483] Re: Symbol#<=>
— Koji Arai <JCA02266@...>
2000/03/24
新井です。
[#9489] parsedate2 — Tadayoshi Funaba <tadf@...>
ふなばです。
7 messages
2000/03/25
[#9498] timeout しない timeout — ARIMA Yasuhiro <fit0298@...>
有馬です。
20 messages
2000/03/26
[#9506] Re: timeout しない timeout
— matz@... (Yukihiro Matsumoto)
2000/03/27
まつもと ゆきひろです
[#9509] Re: timeout しない timeout
— gotoken@... (GOTO Kentaro)
2000/03/27
In message "[ruby-dev:9506] Re: timeout しない timeout"
[#9511] Re: timeout しない timeout
— matz@... (Yukihiro Matsumoto)
2000/03/27
まつもと ゆきひろです
[#9512] Re: timeout しない timeout
— ARIMA Yasuhiro <fit0298@...>
2000/03/27
有馬です。
[#9524] Re: timeout しない timeout
— ARIMA Yasuhiro <fit0298@...>
2000/03/29
有馬です。
[#9525] Re: timeout しない timeout
— gotoken@... (GOTO Kentaro)
2000/03/29
ごとけんです
[#9526] Re: timeout しない timeout
— ARIMA Yasuhiro <fit0298@...>
2000/03/29
有馬です。
[#9528] Re: timeout しない timeout
— gotoken@... (GOTO Kentaro)
2000/03/30
ごとけんです
[#9529] Re: timeout しない timeout
— ARIMA Yasuhiro <fit0298@...>
2000/03/30
有馬です。
[ruby-dev:9515] Re: parsedate2
From:
Tadayoshi Funaba <tadf@...>
Date:
2000-03-27 10:12:24 UTC
List:
ruby-dev #9515
ふなばです。 parsedate2 の成果をふまえて、parsedate 式のアプローチで、parsedate3 を デッチあげてみました。とりあえず、参考までに出しておきます。 parsedate2 が想定していたパターンの殆どあつかえそうです。僕が試した、 いくつかのパターンでは、parsedate よりも若干速かったです。parsedate よ り、ホンのちょっとだけ判りやすいかもしれないです。 やはり、元の parsedate は、行き当たりばったりな変更がたたって (って、 僕もやってますが)、若干おかしなところがでてきていますね。重複もありま すし。 ふなば ただよし
Attachments (1)
parsedate3.rb
(3.13 KB, text/x-ruby)
# parsedate3.rb: Written by Tadayoshi Funaba 2000
# $Id: parsedate3.rb,v 1.1 2000/03/26 11:55:40 tadf Exp $
module ParseDate
MONTHS = {
'jan' => 1, 'feb' => 2, 'mar' => 3, 'apr' => 4,
'may' => 5, 'jun' => 6, 'jul' => 7, 'aug' => 8,
'sep' => 9, 'oct' =>10, 'nov' =>11, 'dec' =>12
}
MONTHPAT = MONTHS.keys.sort.reverse.join('|')
DAYS = {
'sun' => 0, 'mon' => 1, 'tue' => 2, 'wed' => 3,
'thu' => 4, 'fri' => 5, 'sat' => 6
}
DAYPAT = DAYS.keys.sort.reverse.join('|')
def parsedate(date, cyear=false)
date = date.dup
# day
if date.sub!(/(#{DAYPAT})\S*/ino, ' ')
wday = DAYS[$1.downcase]
end
# time
if date.sub!(
/(\d+):(\d+)(?::(\d+))?
(?:
\s*
([ap])\.?m\.?
)?
(?:
\s*
(
[a-z]+(?:\s+dst)?
|
[-+]\d+(?::?\d+)
)
)?
/inox,
' ')
hour = $1.to_i
min = $2.to_i
sec = $3.to_i if $3
hour += 12 if $4 and $4.downcase == 'p'
zone = $5
end
# eu
if date.sub!(
/(\d+)\S*
\s+
(#{MONTHPAT})\S*
(?:
\s+
(\d+)
)?
/inox,
' ')
mday = $1.to_i
mon = MONTHS[$2.downcase]
year = $3.to_i if $3
end
# us
if date.sub!(
/(#{MONTHPAT})\S*
\s+
(\d+)\S*
(?:
\s+
(\d+)
)?
/inox,
' ')
mon = MONTHS[$1.downcase]
mday = $2.to_i
year = $3.to_i if $3
end
# iso
if date.sub!(/(\d+)-(\d+)-(\d+)/no, ' ')
year = $1.to_i
mon = $2.to_i
mday = $3.to_i
mday, mon, year = year, mon, mday if $3.size >= 4
end
# jis
if date.sub!(/([MTSH])(\d+)\.(\d+)\.(\d+)/no, ' ')
e = { 'M'=>1867,
'T'=>1911,
'S'=>1925,
'H'=>1988
}[$1]
year, mon, mday = ($2.to_i + e), $3.to_i, $4.to_i
end
# vms
if date.sub!(/(\d+)-(#{MONTHPAT})\S*-(\d+)/ino, ' ')
mday = $1.to_i
mon = MONTHS[$2.downcase]
year = $3.to_i
year, mon, mday = mday, mon, year if $1.size >= 4
end
# sla
if date.sub!(%r|(\d+)/(\d+)(?:/(\d+))?|no, ' ')
mon = $1.to_i
mday = $2.to_i
year = $3.to_i if $3
year, mon, mday = mon, mday, year if $1.size >= 4
end
# ddd
if date.sub!(
/(\d{4,14})
(?:
\s*
T?
\s*
(\d{2,6})
)?
(?:
\s*
(
Z
|
[-+]\d{2,4}
)
)?
/nox,
' ')
case $1.size
when 4
mon = $1[ 0, 2].to_i
mday = $1[ 2, 2].to_i
when 6
year = $1[ 0, 2].to_i
mon = $1[ 2, 2].to_i
mday = $1[ 4, 2].to_i
when 8, 10, 12, 14
year = $1[ 0, 4].to_i
mon = $1[ 4, 2].to_i
mday = $1[ 6, 2].to_i
hour = $1[ 8, 2].to_i if $1.size >= 10
min = $1[10, 2].to_i if $1.size >= 12
sec = $1[12, 2].to_i if $1.size >= 14
end
if $2
case $2.size
when 2, 4, 6
hour = $2[ 0, 2].to_i
min = $2[ 2, 2].to_i if $2.size >= 4
sec = $2[ 4, 2].to_i if $2.size >= 6
end
end
zone = $3
end
if cyear and year
if year < 100
if year >= 69
year += 1900
else
year += 2000
end
end
end
return year, mon, mday, hour, min, sec, zone, wday
end
module_function :parsedate
end