note description: "Absolute times" legal: "See notice at end of class." status: "See notice at end of class." date: "$Date: 2017-03-29 12:26:46 +0000 (Wed, 29 Mar 2017) $" revision: "$Revision: 100065 $" access: time eis: "name=Obtaining a DATE from a DATE_TIME and vice versa", "src=$(ISE_DOC_UUID)/195849fc-1a9c-d734-2d2b-acae78133886#Obtaining_a_DATE_from_a_DATE_TIME_and_vice_versa", "tag=EiffelTime" class interface TIME create make, make_fine, make_now, make_now_utc, make_by_seconds, make_by_fine_seconds, make_from_string, make_from_string_default, make_by_compact_time feature -- Initialization make (h, m, s: INTEGER_32) -- Set hour, minute' and second to h, m, s respectively. require correct_time: is_correct_time (h, m, s.to_double, False) ensure hour_set: hour = h minute_set: minute = m second_set: second = s fractional_second_set: fractional_second = 0.to_double make_fine (h, m: INTEGER_32; s: REAL_64) -- Set hour, minute' and second to h, m and truncated to -- integer part of s respectively. -- Set fractional_second to the fractional part of s. require correct_time: is_correct_time (h, m, s, False) ensure hour_set: hour = h minute_set: minute = m fine_second_set: fine_second = s make_now -- Set current time according to timezone. make_now_utc -- Set the current object to today's date in utc format. make_by_seconds (sec: INTEGER_32) -- Set the object by the number of seconds sec from midnight. require s_large_enough: sec >= 0 s_small_enough: sec < Seconds_in_day ensure seconds_set: seconds = sec make_by_fine_seconds (sec: REAL_64) -- Set the object by the number of seconds sec. require s_large_enough: sec >= 0.to_double s_small_enough: sec < Seconds_in_day.to_double make_from_string_default (s: STRING_8) -- Initialize from a "standard" string of form -- default_format_string. require s_exists: s /= Void time_valid: time_valid (s, default_format_string) make_from_string (s: STRING_8; code: STRING_8) -- Initialize from a "standard" string of form -- code. require s_exists: s /= Void c_exists: code /= Void time_valid: time_valid (s, code) make_by_compact_time (c_t: INTEGER_32) -- Initialize from compact_time. require c_t_valid: compact_time_valid (c_t) ensure compact_time_set: compact_time = c_t feature -- Access Origin: TIME -- Origin time feature -- Comparison is_less alias "<" (other: like Current): BOOLEAN -- Is the current time before other? feature -- Measurement duration: TIME_DURATION -- Duration elapsed from midnight ensure then seconds_large_enough: Result.seconds_count >= 0 seconds_small_enough: Result.seconds_count < Seconds_in_day seconds: INTEGER_32 -- Number of seconds elapsed from midnight ensure result_definition: Result = duration.seconds_count fine_seconds: REAL_64 -- Number of seconds and fractions of seconds elapsed from midnight feature -- Basic operations plus alias "+" (t: TIME_DURATION): TIME -- Sum of the current time and duration t require t_exists: t /= Void ensure result_exists: Result /= Void relative_duration (other: like Current): TIME_DURATION -- Duration elapsed from other to Current second_add (s: INTEGER_32) -- Add s seconds to the current time. fine_second_add (f: REAL_64) -- Add f seconds to the current time. -- if f has decimals, fractional_second is modified. minute_add (m: INTEGER_32) -- Add m minutes to the current object. hour_add (h: INTEGER_32) -- Add h hours to the current object. second_forth -- Move to next second. second_back -- Move to previous second. minute_forth -- Move to next minute. minute_back -- Move to evious minute. hour_forth -- Move to next hour. hour_back -- Move to evious hour. feature -- Output debug_output: STRING_8 -- Printable representation of time with "standard" -- Form: time_default_format_string -- Was declared in TIME as synonym of out. out: STRING_8 -- Printable representation of time with "standard" -- Form: time_default_format_string -- Was declared in TIME as synonym of debug_output. formatted_out (s: STRING_8): STRING_8 -- Printable representation of time with "standard" -- Form: s require s_exists: s /= Void invariant second_large_enough: second >= 0 second_small_enough: second < Seconds_in_minute fractionals_large_enough: fractional_second >= 0.to_double fractionals_small_enough: fractional_second < 1.to_double minute_large_enough: minute >= 0 minute_small_enough: minute < Minutes_in_hour hour_large_enough: hour >= 0 hour_small_enough: hour < Hours_in_day note copyright: "Copyright (c) 1984-2017, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class TIME
Generated by ISE EiffelStudio