INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "DURATION"
project: "The Universal Time & Date UTDC"
revision: "$Revision: 1.1 $"
copyright: "Copyright (C) 1996-2005 Object Tools Group"
license: "http://visual-eiffel.com/license"
cluster: timedate
class DURATION
inherit

SHORT_DURATION
undefine
clear,
divide_by,
divide_by_duration,
minus,
multiply_by,
plus,
ratio,
infix "+",
infix "-",
infix "<"
redefine
as_hours,
as_minutes,
as_seconds
end

LONG_DURATION
undefine
clear,
divide_by,
divide_by_duration,
minus,
multiply_by,
plus,
ratio,
infix "+",
infix "-",
infix "<"
redefine
as_days,
as_months,
as_years
end
creation

clear,
set,
set_from_compressed
feature

set (yr, mh, dy, hr, me: INTEGER; sd: DOUBLE)
require
date_time_valid: sd < tt.seconds_in_minute and then sd > - tt.seconds_in_minute and then me < tt.minutes_in_hour and then me > - tt.minutes_in_hour and then hr < tt.hours_in_day and then hr > - tt.hours_in_day and then dy <= tt.days_in_month_d and then dy >= - tt.days_in_month_d and then mh <= tt.months_in_year and then mh >= - tt.months_in_year

clear

as_seconds: DOUBLE

as_minutes: DOUBLE

as_hours: DOUBLE

as_days: DOUBLE

as_months: DOUBLE

as_years: DOUBLE

infix "<" (ts: like Current): BOOLEAN

infix "-", minus (d: like Current): like Current

infix "+", plus (d: like Current): like Current

multiply_by (n: INTEGER): like Current

divide_by (n: INTEGER): like Current
require
non_zero_divider: n /= 0

ratio, divide_by_duration (d: like Current): DOUBLE
require
non_zero_param: d.as_seconds /= 0

set_from_compressed (day, millisec: INTEGER)
end -- class DURATION

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES