changeset 11:84d3608bb529 draft

RCS-revision 1.12 date: 2004/02/15 13:01:52; author: yuuji; state: Exp; lines: +10 -4 Notify message fixed
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 15 Feb 2004 13:01:52 +0859
parents b2f1a9482975
children d7c978950000
files after5.rb
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/after5.rb	Sun Feb 08 15:43:59 2004 +0859
+++ b/after5.rb	Sun Feb 15 13:01:52 2004 +0859
@@ -2,8 +2,8 @@
 #
 # Associative Scheduling Table - after5
 # (C)2003, 2004 by HIROSE Yuuji [yuuji@gentei.org]
-# $Id: after5.rb,v 1.11 2004/02/08 15:43:59 yuuji Exp $
-# Last modified Mon Feb  9 00:33:48 2004 on firestorm
+# $Id: after5.rb,v 1.12 2004/02/15 13:01:52 yuuji Exp $
+# Last modified Sat Feb 14 22:33:40 2004 on firestorm
 # See http://www.gentei.org/~yuuji/software/after5/
 # このスクリプトはEUCで保存してください。
 
@@ -2188,15 +2188,21 @@
       content = datehash.sort.collect{|date, filehash|
 	next unless /(\d\d\d\d+)-(\d+)-(\d+)-(\d\d\d\d)/ =~ date
 	y, m, d, t = $1.to_i, $2.to_i, $3.to_i, $4.to_i
+	ddiff=(Time.mktime(y, m, d) \
+	       - Time.mktime(now.year, now.month, now.day))/3600/24
 	if t > 2359
 	  hhmm = msg('allday')
-	  comment = msg(now.hour > 18 ? 'precedingday' : 'theday')
+	  if ddiff > 1
+	    comment = "%d%s" % [ddiff, msg('days', 'before')]
+	  else
+	    comment = msg(now.hour > 18 ? 'precedingday' : 'theday')
+	  end
 	else
 	  hhmm = sprintf "%02d:%02d", t/100, t%100
 	  diff = Time.mktime(y, m, d, t/100, t%100) - now
 	  if diff < 7200
 	    comment = "%d%s" % [diff/60, msg('minutes', 'before')]
-	  elsif (ddiff=(Time.mktime(y, m, d)-Time.mktime(now.year, now.month, now.day))/3600/24) == 0
+	  elsif (ddiff == 0)
 	    comment = "%s%d%s" %
 	      [msg('about'), diff/3600, msg('hours', 'before')]
 	  else

yatex.org