Introduction
If you’ve been following Tau Station’s progress, you know we’re creating a science fiction universe in Perl for people to enjoy. As of this writing, the time in Tau Station is 194.18/89:189 GCT.
“GCT” stands for “Galactic Coordinated Time” and that’s a variant of metric time. Our software developers wish we had that in the real world, but alas, we don’t.
Galactic Coordinated Time
The exact date in the galaxy is uncertain, but it is believed to be around 2600 CE, using the pre-metric time system. Due to the uncertainty, time is measured in cycles since the Catastrophe (AC). Years before the Catastrophe are not tracked, as humanity is uncertain of what happened beyond scattered documents.
Time across the galaxy is measure as GCT — Galactic Coordinated Time. It has four components, cycle, day, segment, and unit.
cycle
This is the number of cycles since the Catastrophe, with a cycle being 100 days.
day
The number of days in the cycle, a number from 00 to 99.
segment
The day is broken up into 100 segments. Each segment is almost a "quarter hour" of old Earth time (14.4 minutes each).
unit
Each segment is broken up into 1000 units. Each unit is slightly less than a second of old Earth time (0.864 seconds each).
Formats
The official format of GCT is cycle.day/segment:unit GCT:
193.99/59:586 GCT
The above example represents 193 cycles after the Catastrophe, the 99th day, 59% of the day has gone by, and a bit over half of that segment has transpired. That would be just over 53 years in the pre-metric time system.
The official time format is /segment:unit GCT
/59:586 GCT
Durations are represented with a leading D, so, in order to indicate exactly three days we have:
D0.3/00:000 GCT
Though in practice, the cycle is often dropped:
D3/00:000 GCT
Shuttle schedules from station to station often show how many segments and units the travel lasts, so a shuttle trip lasting 2 segments and 15 units would show:
D/02:015 GCT
Notes
- A unit is exactly 0.864 seconds of old Earth time
- A segment is exactly 14.4 minutes of old Earth time
- External blog link: Metric Time in Tau Station
Code Snippets
Just for fun, a few of the actual in-game code snippets.
Displaying GCT
my $days = sprintf "%9.5f" => $elapsed_seconds / 86_400;
$days =~ m{^
(?<cycle>\d+)
(?<day>\d\d)
\.
(?<segment>\d\d)
(?<unit>\d\d\d)
}ax;
my $gct = "$+{cycle}.$+{day}/$+{segment}:$+{unit} GCT";
Durations
my $days = sprintf "%9.5f" => $duration_in_seconds / 86_400;
$days =~ m{^
(?<cycles>\d+)
(?<days>\d\d)
\.
(?<segments>\d\d)
(?<units>\d\d\d)
}ax;
my $duration => "D$+{cycles}.$+{days}/$+{segments}:$+{units}";
Total Seconds
sub period (%args) {
my $seconds = delete $args{seconds} // 0;
$seconds += ( delete $args{minutes} // 0 ) * 60;
$seconds += ( delete $args{hours} // 0 ) * 3_600;
$seconds += ( delete $args{days} // 0 ) * 86_400;
# solar year
$seconds += ( delete $args{years} // 0 ) * 31_556_925.97474;
$seconds += ( delete $args{units} // 0 ) * .864;
$seconds += ( delete $args{segments} // 0 ) * 864;
if ( keys %args ) {
my $unknown = join ', ' => sort keys %args;
croak("Unknown keys to Veure::Util::Time::period: $unknown");
}
return round($seconds);
}
Ovid's Script
#!/usr/bin/env perl
# This program constantly prints the time in GCT (Galactic Coordinated Time)
# as used in the MMORPG Tau Station (https://taustation.space/)
# Obviously, we use something a bit more sophisticated than this :)
use strict;
use warnings;
use Time::HiRes 'sleep';
$|++; # unbuffer STDOUT
use constant UNITS_PER_SEGMENT => 1000;
use constant SEGMENTS_PER_DAY => 100;
use constant UNITS_PER_DAY => UNITS_PER_SEGMENT * SEGMENTS_PER_DAY;
use constant DAYS_PER_CYCLE => 100;
use constant UNITS_PER_CYCLE => UNITS_PER_DAY * DAYS_PER_CYCLE;
use constant SECONDS_PER_UNIT => 0.864;
while (1) {
print "\r"; # clear the line
print gct();
sleep SECONDS_PER_UNIT;
}
sub gct {
my $epoch = time;
$epoch += 187574400;
my $units = $epoch / SECONDS_PER_UNIT;
my $cycle = int( $units / UNITS_PER_CYCLE );
$units -= $cycle * UNITS_PER_CYCLE;
my $day = int( $units / UNITS_PER_DAY );
$units -= $day * UNITS_PER_DAY;
my $segment = int( $units / UNITS_PER_SEGMENT );
$units -= $segment * UNITS_PER_SEGMENT;
my $unit = int($units);
return sprintf '%d.%02d/%02d:%03d GCT', $cycle, $day, $segment, $unit;
}