Table of Contents

Railway Time

In the real life, trains run according to a timetable. It tells when the train will depart and arrive at which location. Advtrains has the goal to make this possble as well. However, there is a problem:

Advtrains relies on the Minetest engine's “dtime” value. Every server step, the “time” in advtrains advances by the “dtime” amount, trains move accordingly, ATC commands are counted. However, this advtrains-internal time is in no way synchronized to the real-life time, due to:

This means that implementing a “timetable” system using the “real time” is not practical.

Therefore we introduce a custom time system, the RWT(Railway Time), which has nothing to do with RLT(Real-Life Time).

RWT has a time cycle of 1 hour. This should be sufficient for most train lines that will ever be built in Minetest.

Below is a brief overview of RWT. The full API can be found here.

Time Format

A RWT looks like this:

37;25

The ; is to distinguish it from a normal RLT (which has colons e.g. 12:34:56). Left number is minutes, right number is seconds.

The minimum RWT is 00;00, the maximum is 59;59.

It is OK to leave one places out at either end, esp. when writing relative times, such as:

43;3   22;0   2;30   0;10  ;10

Those places are then filled with zeroes. Indeed, ; would be valid for 00;00.

Cycle

There is a third value, which essentially tells the number of hours since some reference ingame point in time time, which varies per server and world. It just counts upwards and is never reset.

243;00;15
Example for a RWT in cycle 243

If a cycle is omitted, it is assumed as “Don't care”, so either the current/next cycle or 0, depending on what makes more sense in the situation. You should never be required to fiddle around with cycles.

Lua Representation

In the source code and in all Lua interfaces, a Railway Time is represented like this:

1;23;45 = {
	s=45,
	m=23,
	c=1, -- Cycle(~hour), not displayed most time
}

Real-life Time Adaption Mode

For public servers which run continuously, it appears reasonable to have the Railway Time synchronized to the real-life time. Therefore, a “Time adaption mode” has been added. It is controlled by a minetest.conf setting “advtrains_lines_rwt_realtime”.

# This controls how the Railway Time relates to real-world time:
# *independent - RWT counts independent of real time synchronized to ingame steps. Recommended for singleplayer and ad-hoc servers.
# *follow_real - RWT is independent of real time, but counts up in real-world time speed
# *adapt_real - RWT adapts its minute and second to real-world time. When the server is stopped and restarted, this results in a "time jump".
# Time will jump for 1 cycle (59;59) at maximum.