Stardate 79840.7, da-x's log, supplemental:

One bright day a few years ago, I ran the date UNIX command on my box, and a thought bumped to my head about why I don't see the current stardate every now and then, and as a sworn Trekkie I felt something is missing in my computing experience.

So I fired up google and read a few FAQs about stardates. Soon I found what I think is the best stardate representation and calculation which correlates nicely to the Star Trek show. It is based on a research which was done on each and every occurrences of stardates in Star Trek.

([c]) X(.Y)
  • X - A decimal number which ranges from 0 to 99999 and rounds up every 100 solar years, so that each 1000 units is one solar year. The epoch for this is January 1, 2323, 00:00 UTC. For example, January 1, 2373, is roughly stardate 50000, and July 1, 2389 is around 66500. About dates before 2323, the 100 years roundup goes also backward, so July 1, 2289 is also 66500. Since seasons in Star Trek shows are per year, you notice a roughly 1000 differential between consecutive seasons.
  • c - In order to resolve the ambiguousness revolving X, c is an optional integer for the number of centuries that set your distance form 2323. For example, July 1, 1989: around stardate [-4] 66500.
  • .Y - An optional extension to the date which stands for the part of day. Note that the point is not a floating point for X, it's just a separator. The Y number can be one or more digits, which determine the precision. 3 digits of Y would be the equivalent of Internet Time. On Captain's log, there's almost always only one digit.

The next Perl function calculates a Stardate according to the method described above:

sub stardate {
    my $t = shift;
    my $precision = shift;
    my $stardate_epoch = 11139552000;
    my $absolute = (($t - $stardate_epoch) / (31556.952));
    my $centuries = int($absolute/100000)-1;
    my $relative = int($absolute - $centuries*100000 + 0.5);
    my $part_of_day = (($t - $stardate_epoch) % 86400)/86400.0;
    my $part_of_day_str = sprintf("%.".$precision."f", $part_of_day);
    my $choped_part_of_day = substr($part_of_day_str, 2, length($part_of_day_str)-2);

    return sprintf("%d.%s", $relative, $choped_part_of_day);
The first parameter is the UNIX time, and the second is the part-of-day precision. Example: stardate(time(), 3) -> 79858.386.

So fanatically, I've written a Window Maker applet which displays the current stardate along with a Starfleet logo. Here: . I once even modified ls to show stardates but that's too abhorring to put on the Internet.