Interface TimeAPI
- All Known Implementing Classes:
TimeModule
public interface TimeAPI
API definition for the time module,
TimeModule.
The time module contains methods and calls to access, modify, and query the time subsystem.
-
Method Summary
Modifier and TypeMethodDescriptionvoidSet the current time frame to real time.voidSet the current time frame to simulation time.longReturn the current simulation time as the number of milliseconds since 1970-01-01T00:00:00Z (UTC).int[]Return the current UTC simulation time in an array.booleanQuery whether the simulation time is on or not.voidUnset the target time bookmark from the global clock, if any.voidset_clock(int yr, int month, int day, int hour, int min, int sec, int ms) Set the time of the application to the given time, in UTC.voidset_clock(long time) Set the time of the application.voidset_max_simulation_time(long yr) Set the maximum simulation time allowed, in years.voidset_target_time(int yr, int month, int day, int hour, int min, int sec, int ms) Set a time bookmark in the global clock that, when reached, the clock automatically stops.voidset_target_time(long ms) Set a time bookmark in the global clock that, when reached, the clock automatically stops.voidset_time_warp(double warp) Set the simulation time warp factor.voidStart simulation time.voidStop simulation time.voidtransition(int yr, int month, int day, int hour, int min, int sec, int ms, double duration, String smooth_type, double smooth_factor, boolean sync) Create a time transition from the current time to the given time (year, month, day, hour, minute, second, millisecond).
-
Method Details
-
activate_real_time_frame
void activate_real_time_frame()Set the current time frame to real time. All the commands executed after this command becomes active will be in the real time frame (real clock ticks). -
activate_simulation_time_frame
void activate_simulation_time_frame()Set the current time frame to simulation time. All the commands executed after this command becomes active will be in the simulation time frame (simulation clock ticks). -
set_clock
void set_clock(int yr, int month, int day, int hour, int min, int sec, int ms) Set the time of the application to the given time, in UTC.- Parameters:
yr- The year to represent.month- The month-of-year to represent, from 1 (January) to 12 (December).day- The day-of-month to represent, from 1 to 31.hour- The hour-of-day to represent, from 0 to 23.min- The minute-of-hour to represent, from 0 to 59.sec- The second-of-minute to represent, from 0 to 59.ms- The millisecond-of-second, from 0 to 999.
-
get_clock
long get_clock()Return the current simulation time as the number of milliseconds since 1970-01-01T00:00:00Z (UTC).- Returns:
- Number of milliseconds since the epoch (Jan 1, 1970 00:00:00 UTC).
-
set_clock
void set_clock(long time) Set the time of the application. The long value represents specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.- Parameters:
time- Number of milliseconds since the epoch (Jan 1, 1970).
-
get_clock_array
int[] get_clock_array()Return the current UTC simulation time in an array.- Returns:
- The current simulation time in an array with the given indices.
- 0 - The year.
- 1 - The month, from 1 (January) to 12 (December).
- 2 - The day-of-month, from 1 to 31.
- 3 - The hour-of-day, from 0 to 23.
- 4 - The minute-of-hour, from 0 to 59.
- 5 - The second-of-minute, from 0 to 59.
- 6 - The millisecond-of-second, from 0 to 999.
-
start_clock
void start_clock()Start simulation time. This method causes the clock to start ticking at the current pace. You can modify the clock pace withset_time_warp(double). -
stop_clock
void stop_clock()Stop simulation time. -
is_clock_on
boolean is_clock_on()Query whether the simulation time is on or not.- Returns:
- True if the time is on, false otherwise.
-
set_time_warp
void set_time_warp(double warp) Set the simulation time warp factor. Positive values make time advance forward, while negative values make time run backwards. A warp factor of 1 sets a real time pace to the simulation time.- Parameters:
warp- The warp as a factor. A value of 2.0 sets the Gaia Sky time to be twice as fast as real world time.
-
set_target_time
void set_target_time(long ms) Set a time bookmark in the global clock that, when reached, the clock automatically stops.- Parameters:
ms- The time as the number of milliseconds since the epoch (Jan 1, 1970).
-
set_target_time
void set_target_time(int yr, int month, int day, int hour, int min, int sec, int ms) Set a time bookmark in the global clock that, when reached, the clock automatically stops.- Parameters:
yr- The year to represent.month- The month-of-year to represent, from 1 (January) to 12 (December).day- The day-of-month to represent, from 1 to 31.hour- The hour-of-day to represent, from 0 to 23.min- The minute-of-hour to represent, from 0 to 59.sec- The second-of-minute to represent, from 0 to 59.ms- The millisecond-of-second, from 0 to 999.
-
remove_target_time
void remove_target_time()Unset the target time bookmark from the global clock, if any. -
set_max_simulation_time
void set_max_simulation_time(long yr) Set the maximum simulation time allowed, in years. This sets the maximum time in the future (years) and in the past (-years). This setting is not saved to the configuration and resets to 5 Myr after restart.- Parameters:
yr- The maximum year number to allow.
-
transition
void transition(int yr, int month, int day, int hour, int min, int sec, int ms, double duration, String smooth_type, double smooth_factor, boolean sync) Create a time transition from the current time to the given time (year, month, day, hour, minute, second, millisecond). The time is given in UTC.- Parameters:
yr- The year to represent.month- The month-of-year to represent, from 1 (January) to 12 (December).day- The day-of-month to represent, from 1 to 31.hour- The hour-of-day to represent, from 0 to 23.min- The minute-of-hour to represent, from 0 to 59.sec- The second-of-minute to represent, from 0 to 59.ms- The millisecond-of-second, from 0 to 999.duration- The duration of the transition, in seconds.smooth_type- The function type to use for smoothing. Either "logit", "logisticsigmoid" or "none".- "logisticsigmoid": starts slow and ends slow. The smooth factor must be over 12 to produce an effect, otherwise, linear interpolation is used.
- "logit": starts fast and ends fast. The smooth factor must be between 0.09 and 0.01.
- "none": no smoothing is applied.
smooth_factor- Smoothing factor (depends on type, see #smoothType).sync- If true, the call waits for the transition to finish before returning, otherwise it returns immediately.
-