# $Id: ScheduledConference.pm,v 1.4 2008/02/29 01:55:37 swick Exp $

package ScheduledConference;
use strict;
use Time::Local;

my %Schedule;

sub new
{
    my ($proto, $hcode, $gcode, $date, $time, $duration, $confType,
	$confNum, $confName, $schedID, $ports) = @_;

    my $class = ref($proto) || $proto;

    my $self  = {
	'code'		=> $gcode,
	'duration'	=> $duration,
	'type'		=> $confType,
	'number'	=> $confNum,
	'name'		=> $confName,
	'schedID'	=> $schedID,
	'ports'		=> $ports,
    };

    if ($date && $time) {
	$date =~ m/(\d\d\d\d)(\d\d)(\d\d)/;
	my ($year, $month, $day) = ($1, $2, $3);
	$time =~ m/(\d\d)(\d\d)/;
	my ($hour, $min) = ($1, $2);
	$self->{start} =
	    timelocal(0, $min, $hour, $day, $month-1, $year);
	$self->{start} -= 24*60*60 if $::LeapDayFix;
    }
    else {
	$self->{start} = 0;
    }

    bless ($self, $class);

    return $self;
}

sub code
{
    my ($self) = @_;
    return $self->{code};
}

sub name
{
    my ($self) = @_;
    return $self->{name};
}

sub start
{
    my ($self) = @_;
    return $self->{start};
}

sub duration
{
    my ($self) = @_;
    return $self->{duration};
}

sub ports
{
    my ($self) = @_;
    return $self->{ports};
}

1;
