Net::SDP::Time - Time Description in an SDP file


Net-SDP documentation  | view source Contained in the Net-SDP distribution.

Index


NAME

Top

Net::SDP::Time - Time Description in an SDP file

SYNOPSIS

Top

  my $time = $sdp->new_time_desc();

  print "Session started: ".$time->start_time();

  $time->make_permanent();

DESCRIPTION

Top

This class represents a single Time Description (t=) in an SDP file. When parsing an SDP file, Net::SDP will create an instance of Net::SDP::Time for each time description. New time descriptions can be created using the new_time_desc() method in Net::SDP.

METHODS

start_time_ntp()

Get or Set the Start Time as decimal representation of Network Time Protocol (NTP) time values in seconds. [t=]

Example:

	$start_ntp = $time->start_time_ntp();
	$time->start_time_ntp( 3303564104 );




end_time_ntp()

Get or Set the End Time as decimal representation of Network Time Protocol (NTP) time values in seconds. [t=]

Example:

	$end_ntp = $time->end_time_ntp();
	$time->end_time_ntp( 3303567704 );




start_time_unix()

Get or Set the Start Time as decimal Unix time stamp. [t=]

Example:

	$start = $time->start_time_unix();
	$time->start_time_unix( time() );




end_time_unix()

Get or Set the End Time as decimal Unix time stamp. [t=]

Example:

	$end = $time->end_time_unix();
	$time->end_time_unix( time()+3600 );




start_time()

Get a textual representation of the Start Time. [t=]

Example:

	print "Session starts: ".$time->start_time();




end_time()

Get a textual representation of the End Time. [t=]

Example:

	print "Session ends: ".$time->end_time();




is_permanent()

Returns true if the session is permanent. Returns false if the session has a start or end time. [t=]

make_permanent()

Makes the session permanent - no start or end time. [t=]

is_unbounded()

Returns true if the session has no end time. Returns false if the session has an end time. [t=]

make_unbounded()

Makes the session unbounded - no end time. [t=]

repeat_add($interval, $duration, $offset)

For a session that shows every day (86400, 1440m, 24h or 1d) for one hour (3600, 60m or 1h) with an origin time from $time->start_time_ntp(). This session then repeats that day six hours (21600, or 360m or 6h) later.

	my ( $interval, $duration ) = ( 86400, 3600 );
	my $offsets = [ 0, 21600 ]; # ARRAYREF
	$time->repeat_add($interval, $duration, $offsets);

This produces an 'r' field of: r=1d 1h 0 6h

RFC2327 (http://www.ietf.org/rfc/rfc2327.txt), page 14 titled "Times, Repeat Times and Time Zones" should be consulted for clarification.

N.B. $offsets can be a single value (typically 0) regular SCALAR instead but then you obviously only get a single value

[r=]

repeat_delete($num)

Delete repeat field element $num. Returns 0 on sucess, 1 if its a bad request. [r=]

repeat_delete_all()

Deletes any exising repeat fields. [r=]

repeat_desc($num)

Returns repeat array element $num.

	my $repeat = $time->repeat_desc(2);

If element does not exist 'undef' is returned, if nothing is passed to the function it defaults to the first element. The format of the 'reply' is (all values are in seconds):

	$repeat = { 
	    interval  => <interval>, 
	    duration  => <duration>,
	    offsets  => [ <offset1>, <offset2> ... ]
	};

repeat_desc_arrayref()

Returns all the repeat elements in an ARRAYREF.

as_string()

Returns a textual representation/summary of the time description.

Example:

	'Tue Aug  2 11:13:28 2004 until Tue Aug  2 13:15:00 2004'

AUTHOR

Top

Nicholas J Humfrey, njh@cpan.org

Alexander Clouter, alex@digriz.org.uk

COPYRIGHT AND LICENSE

Top


Net-SDP documentation  | view source Contained in the Net-SDP distribution.