immutable class ELAPSED < $ORDERED{ELAPSED}, $HASH, $BINARY, $TEXT, $ANCHORED_FMT |
---|
**** |
________This_class_embodies_the_abstraction_of_a_period_of_time_rather_than ___an_instant_or_time-stamp.___Values_of_this_kind_are_never_negative. _________Version_1.4_May_2001.___Copyright_K_Hopper,_U_of_Waikato __________________________Development_History __________________________------------------- ________Date___________Who_By_________Detail ________----___________------_________------ ________3_Jun_96________kh_______Original_from_std_Sather_distrib. ________8_Apr_97________kh_______Modified_for_INT_to_CARD _______25_Feb_98________kh_______made_a_sub-class_of_$BINARY ________5_Oct_98________kh_______factored_out_ELAPSED_STR. _______29_Oct_98________kh_______Refined,_added_pre/post_conditions _______31_May_01________kh_______Added_$ORDERED_sub-typing |
$ANCHORED_FMT | $FMT | $STR | $TEXT | $BINARY | $HASH | $IS_EQ | $ORDERED{_} | $IS_LT{_} | $VALUE{_} | $NIL | $IS_NIL |
attr days : CARD ; |
---|
attr millisecs : CARD ; |
---|
const Invalid : SAME := days(CARD::nil).millisecs(CARD::nil) ; |
---|
binstr : BINSTR |
---|
build(cursor : BIN_CURSOR) : SAME |
---|
create(days : CARD, millis : CARD ) : SAME |
---|
create(dtime : TIME_STAMP) : SAME |
---|
**** |
________This_routine_creates_a_new_elapsed_time_--_elapsed_between_the_'base ___date'_and_dtime. |
div( factor : CARD ) : SAME |
---|
hash : CARD |
---|
hours : CARD |
---|
is_eq(other : SAME) : BOOL |
---|
**** |
________This_predicate_returns_true_if_and_only_if_self_and_other_represent ___the_same_elapsed_time. |
is_lt(other : SAME ) : BOOL |
---|
**** |
________This_predicate_returns_true_if_and_only_if_self_and_other_represent ___the_same_elapsed_time. |
is_nil : BOOL |
---|
**** |
________This_predicate_returns_true_if_and_only_if_self_is_a_nil_time. |
milliseconds : CARD |
---|
minus( other : SAME ) : SAME |
---|
minutes : CARD |
---|
minutes_in_hour : CARD |
---|
nil : SAME |
---|
**** |
__This_routine_yields_a_nil_elapsed_time. |
one_day : SAME |
---|
**** |
________This_routine_yields_a_one_day_elapsed_time. |
one_hour : SAME |
---|
**** |
________This_routine_yields_a_one_hour_elapsed_time. |
one_minute : SAME |
---|
**** |
________This_routine_yields_a_one_minute_elapsed_time. |
one_second : SAME |
---|
**** |
________This_routine_yields_a_one_second_elapsed_time. |
plus( other : SAME) : SAME |
---|
seconds : CARD |
---|
seconds_in_minute : CARD |
---|
times( factor : CARD ) : SAME |
---|
total_days : CARD |
---|
**** |
________This_routine_returns_the_whole_number_of_days_in_self |
total_hours : CARD |
---|
total_milliseconds : CARD |
---|
total_minutes : CARD |
---|
total_seconds : CARD |
---|
const Hours_per_Day : CARD := 24 ; |
---|
const Millisecs_per_Day : CARD := Millisecs_per_Second * |
---|
const Millisecs_per_Hour : CARD := 1000 * 60 * 60 ; |
---|
const Millisecs_per_Minute : CARD := 1000 * 60 ; |
---|
const Millisecs_per_Second : CARD := 1000 ; |
---|
const Minutes_per_Day : CARD := 60 * Hours_per_Day ; |
---|
const Minutes_per_Hour : CARD := 60 ; |
---|
const Seconds_per_Day : CARD := 60 * Minutes_per_Day ; |
---|
const Seconds_per_Minute : CARD := 60 ; |
---|
attr days : CARD ; |
---|
do_times( factor : CARD ) : SAME |
---|
**** |
________This_routine_returns_an_elapsed_time_which_has_been_multiplied_by ___the_factor_indicated_provided_that_this_is_possible_without_over-run_when ___the_maximum_representable_elapsed_time_is_returned_-_which_is_nevertheless ___an_invalid_elapsed_time!! ___NOTE_This_has_no_pre-conditions_in_order_to_break_a_mutual_recursion_which ________would_otherwise_happen_indefinitely! |
attr millisecs : CARD ; |
---|
subtract(from, sub : SAME ) : SAME |
---|