The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DateTime::Calendar::TauStation - Handle TauStation GCT datetimes

SYNOPSIS

  use DateTime::Calendar::TauStation;
  
  my $dt = DateTime::Calendar::TauStation->new(
    cycle   => '001',
    day     => '02',
    segment => '03',
    unit    => '004',
  );
  
  print $dt->gct_cycle;
  print $dt->gct_day;
  print $dt->gct_segment;
  print $dt->gct_unit;

Alternatively, combine with DateTime::Duration::TauStation and DateTime::Format::TauStation.

  use DateTime::Calendar::TauStation;
  use DateTime::Format::TauStation;
  
  my $dur = DateTime::Format::TauStation->parse_duration( 'D/20:000 GCT' );
  
  my $dt = DateTime::Calendar::TauStation->now->add_duration( $dur );
  
  print DateTime::Format::TauStation->format_datetime($dt);

DESCRIPTION

DateTime subclass for GCT (Galactic Coordinated Time) datetimes for the online game TauStation.

METHODS

new

Accepts arguments:

gct_cycle
gct_day
gct_segment
gct_unit
gct_sign

catastrophe

Returns the datetime 000.00/00:000 GCT, a.k.a. 1964-01-22T00:00:27.689615 UTC.

gct_sign

Pre-catastrophe dates return a - sign.

gct_cycle

Returns the cycle part of the datetime.

gct_day

Returns the day part of the datetime.

gct_segment

Returns the segment part of the datetime.

gct_unit

Returns the unit part of the datetime.

EXPORTED SUBROUTINES

gct2seconds

Accepts the same arguments as "new", returns a signed integer.

subtract_datetime

Returns a DateTime::Duration::TauStation object.

AUTHOR

Carl Franks

CREDITS

Based on code from https://github.com/zoffixznet/perl6-Games-TauStation-DateTime.

COPYRIGHT

Copyright (c) 2018 Carl Franks.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

DateTime::Duration::TauStation, DateTime::Format::TauStation