indexing
description: "Absolute temporal values composed of a date and a time"
status: "See notice at end of class"
date: "$Date$"
revision: "$Revision$"
access: date, time
class interface
DATE_TIME
create
make (y, mo, d, h, mi, s: INTEGER)
yearmonthdayymod
hourminutesecondhmis
require
correct_date_time: is_correct_date_time (y, mo, d, h, mi, s, False)
ensure
year_set: year = y
month_set: month = mo
day_set: day = d
hour_set: hour = h
minute_set: minute = mi
second_set: second = s
make_fine (y, mo, d, h, mi: INTEGER; s: DOUBLE)
yearmonthdayymod
hourminutesecondhms
require
correct_date_time: is_correct_date_time (y, mo, d, h, mi, s, False)
ensure
year_set: year = y
month_set: month = mo
day_set: day = d
hour_set: hour = h
minute_set: minute = mi
second_set: fine_second = s
make_by_date_time (d: DATE; t: TIME)
datedtimet
require
d_exists: d /= void
t_exists: t /= void
ensure
date_set: date = d
time_set: time = t
make_by_date (d: DATE)
datedtime
require
d_exists: d /= void
ensure
date_set: date = d
time_set: time.is_equal (time.origin)
make_now
make_from_string (s: STRING; code: STRING)
code
require
s_exists: s /= void
c_exists: code /= void
date_time_valid: date_time_valid (s, code)
make_from_string_with_base (s: STRING; code: STRING; base: INTEGER)
codebase
require
s_exists: s /= void
c_exists: code /= void
base_valid: base > 0 and (base \\ 100 = 0)
date_time_valid: date_time_valid_with_base (s, code, base)
make_from_string_default (s: STRING)
default_format_string
require
s_exists: s /= void
date_time_valid: date_time_valid (s, default_format_string)
make_from_string_default_with_base (s: STRING; base: INTEGER)
default_format_stringbase
require
s_exists: s /= void
base_valid: base > 0 and (base \\ 100 = 0)
date_time_valid: date_time_valid_with_base (s, default_format_string, base)
feature
make (y, mo, d, h, mi, s: INTEGER)
yearmonthdayymod
hourminutesecondhmis
require
correct_date_time: is_correct_date_time (y, mo, d, h, mi, s, False)
ensure
year_set: year = y
month_set: month = mo
day_set: day = d
hour_set: hour = h
minute_set: minute = mi
second_set: second = s
make_by_date (d: DATE)
datedtime
require
d_exists: d /= void
ensure
date_set: date = d
time_set: time.is_equal (time.origin)
make_by_date_time (d: DATE; t: TIME)
datedtimet
require
d_exists: d /= void
t_exists: t /= void
ensure
date_set: date = d
time_set: time = t
make_fine (y, mo, d, h, mi: INTEGER; s: DOUBLE)
yearmonthdayymod
hourminutesecondhms
require
correct_date_time: is_correct_date_time (y, mo, d, h, mi, s, False)
ensure
year_set: year = y
month_set: month = mo
day_set: day = d
hour_set: hour = h
minute_set: minute = mi
second_set: fine_second = s
make_from_string (s: STRING; code: STRING)
code
require
s_exists: s /= void
c_exists: code /= void
date_time_valid: date_time_valid (s, code)
make_from_string_default (s: STRING)
default_format_string
require
s_exists: s /= void
date_time_valid: date_time_valid (s, default_format_string)
make_from_string_default_with_base (s: STRING; base: INTEGER)
default_format_stringbase
require
s_exists: s /= void
base_valid: base > 0 and (base \\ 100 = 0)
date_time_valid: date_time_valid_with_base (s, default_format_string, base)
make_from_string_with_base (s: STRING; code: STRING; base: INTEGER)
codebase
require
s_exists: s /= void
c_exists: code /= void
base_valid: base > 0 and (base \\ 100 = 0)
date_time_valid: date_time_valid_with_base (s, code, base)
make_now
feature
date: DATE
date_default_format_string: STRING
DATE_CONSTANTS
date_duration: DATE_DURATION
day: INTEGER
DATE_TIME_MEASUREMENT
ensure DATE_TIME_MEASUREMENT
same_day: Result = date.day
days: INTEGER
origin
days_in_i_th_month (i, y: INTEGER): INTEGER
iy
DATE_CONSTANTS
require DATE_CONSTANTS
i_large_enough: i >= 1
i_small_enough: i <= months_in_year
Days_in_leap_year: INTEGER is 366
DATE_CONSTANTS
Days_in_non_leap_year: INTEGER is 365
DATE_CONSTANTS
Days_in_week: INTEGER is 7
DATE_CONSTANTS
days_text: ARRAY [STRING]
DATE_CONSTANTS
fine_second: DOUBLE
DATE_TIME_MEASUREMENT
ensure DATE_TIME_MEASUREMENT
same_fine_second: Result = time.fine_second
fractional_second: DOUBLE
fine_second
TIME_VALUE
hour: INTEGER
DATE_TIME_MEASUREMENT
ensure DATE_TIME_MEASUREMENT
same_hour: Result = time.hour
Hours_in_day: INTEGER is 24
TIME_CONSTANTS
long_days_text: ARRAY [STRING]
DATE_CONSTANTS
long_months_text: ARRAY [STRING]
DATE_CONSTANTS
Max_weeks_in_year: INTEGER is 53
DATE_CONSTANTS
minute: INTEGER
DATE_TIME_MEASUREMENT
ensure DATE_TIME_MEASUREMENT
same_minute: Result = time.minute
Minutes_in_hour: INTEGER is 60
TIME_CONSTANTS
month: INTEGER
DATE_TIME_MEASUREMENT
ensure DATE_TIME_MEASUREMENT
same_month: Result = date.month
Months_in_year: INTEGER is 12
DATE_CONSTANTS
months_text: ARRAY [STRING]
DATE_CONSTANTS
origin: DATE_TIME
ensure ABSOLUTE
result_exists: Result /= void
second: INTEGER
DATE_TIME_MEASUREMENT
ensure DATE_TIME_MEASUREMENT
same_second: Result = time.second
seconds: INTEGER
Seconds_in_day: INTEGER is 86400
TIME_CONSTANTS
Seconds_in_hour: INTEGER is 3600
TIME_CONSTANTS
Seconds_in_minute: INTEGER is 60
TIME_CONSTANTS
time: TIME
time_default_format_string: STRING
TIME_CONSTANTS
time_duration: TIME_DURATION
year: INTEGER
DATE_TIME_MEASUREMENT
ensure DATE_TIME_MEASUREMENT
same_year: Result = date.year
feature
duration: DATE_TIME_DURATION
origin
ensure then
definite_result: Result.definite
feature
is_equal (other: like Current): BOOLEAN
other
require ANY
other_not_void: other /= void
ensure ANY
symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result
ensure then COMPARABLE
trichotomy: Result = (not (Current < other) and not (other < Current))
max (other: like Current): like Current
other
COMPARABLE
require COMPARABLE
other_exists: other /= void
ensure COMPARABLE
current_if_not_smaller: Current >= other implies Result = Current
other_if_smaller: Current < other implies Result = other
min (other: like Current): like Current
other
COMPARABLE
require COMPARABLE
other_exists: other /= void
ensure COMPARABLE
current_if_not_greater: Current <= other implies Result = Current
other_if_greater: Current > other implies Result = other
three_way_comparison (other: like Current): INTEGER
other
COMPARABLE
require COMPARABLE
other_exists: other /= void
ensure COMPARABLE
equal_zero: (Result = 0) = is_equal (other)
smaller_negative: (Result = - 1) = (Current < other)
greater_positive: (Result = 1) = (Current > other)
infix "<" (other: like Current): BOOLEAN
other
require PART_COMPARABLE
other_exists: other /= void
ensure then COMPARABLE
asymmetric: Result implies not (other < Current)
infix "<=" (other: like Current): BOOLEAN
other
COMPARABLE
require PART_COMPARABLE
other_exists: other /= void
ensure then COMPARABLE
definition: Result = ((Current < other) or is_equal (other))
infix ">" (other: like Current): BOOLEAN
other
COMPARABLE
require PART_COMPARABLE
other_exists: other /= void
ensure then COMPARABLE
definition: Result = (other < Current)
infix ">=" (other: like Current): BOOLEAN
other
COMPARABLE
require PART_COMPARABLE
other_exists: other /= void
ensure then COMPARABLE
definition: Result = (other <= Current)
feature
is_leap_year (y: INTEGER): BOOLEAN
y
DATE_CONSTANTS
feature
add (dtd: DATE_TIME_DURATION)
dtd
day_add (d: INTEGER)
d
ensure
days_set: days = old days + d
definite_duration (other: like Current): DATE_TIME_DURATION
other
require
other_exists: other /= void
ensure
definite_result: Result.definite
fine_second_add (s: DOUBLE)
s
sfractional_secondtime
hour_add (h: INTEGER)
h
minute_add (m: INTEGER)
m
relative_duration (other: like Current): DATE_TIME_DURATION
other
require ABSOLUTE
other_exists: other /= void
ensure ABSOLUTE
result_exists: Result /= void
ensure then
origin_set: equal (other, Result.origin_date_time)
second_add (s: INTEGER)
s
infix "+" (d: DATE_TIME_DURATION): like Current
d
ensure
result_exists: Result /= void
infix "-" (other: like Current): INTERVAL [like Current]
other
ABSOLUTE
require ABSOLUTE
other_exists: other /= void
other_smaller_than_current: other <= Current
ensure ABSOLUTE
result_exists: Result /= void
result_set: Result.start_bound.is_equal (other) and then Result.end_bound.is_equal (Current)
feature
copy (other: like Current)
datetimeother
require ANY
other_not_void: other /= void
type_identity: same_type (other)
ensure ANY
is_equal: is_equal (other)
set_date (d: DATE)
dated
require
d_exists: d /= void
ensure
date_set: date = d
set_time (t: TIME)
timet
require
t_exists: t /= void
ensure
time_set: time = t
feature
formatted_out (s: STRING): STRING
s
require
s_exists: s /= void
out: STRING
default_format_string
feature
date_time_valid (s: STRING; code_string: STRING): BOOLEAN
DATE_TIME
scode_string
DATE_TIME_VALIDITY_CHECKER
require DATE_TIME_VALIDITY_CHECKER
s_exists: s /= void
code_exists: code_string /= void
date_time_valid_with_base (s: STRING; code_string: STRING; base: INTEGER): BOOLEAN
DATE_TIME
scode_string
base
DATE_TIME_VALIDITY_CHECKER
require DATE_TIME_VALIDITY_CHECKER
s_exists: s /= void
code_exists: code_string /= void
base_valid: base > 0 and (base \\ 100 = 0)
is_correct_date_time (y, mo, d, h, mi: INTEGER; s: DOUBLE; twelve_hour_scale: BOOLEAN): BOOLEAN
ymodhmis
twelve_hour_scale
DATE_TIME_VALIDITY_CHECKER
invariant
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
COMPARABLE
irreflexive_comparison: not (Current < Current)
DATE_TIME_MEASUREMENT
date_exists: date /= void
time_exists: time /= void
end -- DATE_TIME