JMRI: Setup Fast Clock
Author: Bob Jacobsen
Keywords: JMRI help Setup Fast Clock

# Fast Clock Setup

## Introduction to JMRI Fast Clocks

JMRI provides a fast clock that can get its time from an internal fast clock or a selected hardware fast clock if one exists on your layout.

This window ( Tools > Clocks > Set up Fast Clock ) provides for setting options for this fast clock system.

Information you set up here is saved when you save your panels and configuration and allows you to set start up options that take effect when you load your panels and configuration.

JMRI also has clock displays that can run in stand-alone dialogs or on a PanelPro panel.

## Pausing and Running the Fast Clock

Your fast clock may be set paused or running by using the :

- Pause Clock / Run Clock button at the top of this setup window.
- Pause / Run button at the bottom or side of a clock window.
- Internal sensor with system name ISCLOCKRUNNING

When the fast clock is resumed after having been paused, the fast clock time continues where it left off.

The current fast time is displayed at the top of the screen, the tooltip of which displays the full date, time and timezone.

## Setting Fast Clock Time and Fast Clock Rate

The Fast Clock Time is entered as hours and minutes using a 24-hour clock. After entry click the Set button, the time is updated and broadcast to synchronized clocks.

The Fast Clock Rate is a factor that multiplies the wall clock time rate.
For example, a fast clock rate of 4.000 means that the fast clock will run 4 times faster than the wall clock, or will move an hour when the wall clock only moves 15 minutes.

Enter your fast clock rate after Fast Clock Rate:, then click the Set button to the right of it.

It's important that all clocks run with the same rate, even if they are synchronized.

If any of the entered values are not right, an error message is displayed, and the time / rate is not changed.

## Setting up your Time Source

Look in the Time Source selection box to see what might be available for your system. If you don't have a hardware fast clock, skip to the next section.

Usually you will want to select Internal Computer Clock even if a hardware fast clock is available. Usually also you will want to check Synchronize Internal Fast Clock with xxxxx Fast Clock so that the two clocks will show the same time, even over long periods.
Both the Fast Clock Rate and the Fast Clock Time are synchronized when you check this option.

For some hardware fast clocks another check box, Correct hardware clock, will be shown.
If you tried using your DCC command station to create a fast clock, you may have noticed that it didn't keep particularly good time.
If Correct hardware clock is available and you check it, JMRI will adjust the rate of your hardware clock so that it keeps better time.

Some hardware fast clocks support changing a 12-hour/24-hour display option from the computer.
For those that do, a check box labeled Use 12-hour clock display, will be shown.
If you check this option, your hardware clock will set up for a 12-hour clock display.
If this option is unchecked (the default), a 24-hour clock display will be set up.

If you select Internal Computer Clock as your time source, and do not check either the Synchronize... or Correct... options, only the internal clock will be used, and no commands will be sent to your hardware clock.

At the end of this documentation there is more information on specific hardware fast clocks, which includes recommendations on the best way to set them up.

Caution: This window may show you have a time source when you really don't have one. For example, if you're running LocoNet Simulator, a LocoNet Fast Clock will be listed but doesn't exist. Unless you know you have the hardware fast clock listed, you should not select the hardware clock as your Time Source, and you should not check either the Synchronize... or Correct... options even if they show on this window.

## Setting Start Up Options

The options set in this section take effect when you load your panel file (or configuration file if you don't have any panels).

The clock can be started up paused or running, depending on the selection.

You can request that your fast clock start at a specified time, by checking Set Fast Clock Time to and entering the time after it.
As with Fast Clock Time, the time is entered as hours and minutes using a 24-hour clock.

If you select a display clock in the Start Selected Clock popup menu, that clock display will be automatically started when your file is loaded.
Clocks displayed on a PanelPro panel are configured using Panel Editor or Layout Editor, and are saved and restarted with your panel.

Important Note: To preserve the settings and options entered in this dialog, you must save your configuration.
Fast clock settings are stored as part of your configuration in the same file as your panels (if you have any).
The safest and easiest way to ensure that all your configuration items and panels are saved is to save using Store Configuration and panels.... (Store panels... may be used even if you don't have any panels.) Store options may be found in the File menu while working on the Fast Clock Setup. A prompt will give you the option to save either form when you close the Fast Clock Setup by clicking Apply.

The clock settings are stored with table content and panels. See Loading and Storing Your Work for details.

## Clock-related Sensor and Memory

When a clock is running, JMRI creates an internal sensor and a memory variable that you can use to control and access the clock.

The ISCLOCKRUNNING sensor controls whether the clock is running (ACTIVE) or stopped (INACTIVE).

The state of this sensor automatically follows the state of the fast clock-Active if the fast clock is running, and Inactive if the fast clock is paused.

You could add a Sensor Icon on your PanelPro panel (Panel Editor or Layout Editor). Changing the state of this sensor will run and pause your fast clock.

Regardless of which method you use to run and pause your fast clock, button labels and the ISCLOCKRUNNING sensor's state follow along.

The IMCURRENTTIME memory contains the current fast-clock time, and can be easily accessed from Logix and scripts.

The format of the time / date string is controlled by the jmri.jmrit.simpleclock.SimpleClockBundle TimeStorageFormat property, and can be changed via the JMRI Internationalization mechanism. More information on the DateFormat mechanism used for this is available here.

## Further Clock Support

JMRI Fast Clocks

There are separate pages for:

- LocoNet clocks
- CBUS® clocks
- NCE clocks

CBUS® is a registered trade mark of Dr Michael Bolton