|
Net::SDP::Time - Time Description in an SDP file |
Net::SDP::Time - Time Description in an SDP file
my $time = $sdp->new_time_desc();
print "Session started: ".$time->start_time();
$time->make_permanent();
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.
Example:
$start_ntp = $time->start_time_ntp();
$time->start_time_ntp( 3303564104 );
Example:
$end_ntp = $time->end_time_ntp();
$time->end_time_ntp( 3303567704 );
Example:
$start = $time->start_time_unix();
$time->start_time_unix( time() );
Example:
$end = $time->end_time_unix();
$time->end_time_unix( time()+3600 );
Example:
print "Session starts: ".$time->start_time();
Example:
print "Session ends: ".$time->end_time();
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=]
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> ... ]
};
Example:
'Tue Aug 2 11:13:28 2004 until Tue Aug 2 13:15:00 2004'
Nicholas J Humfrey, njh@cpan.org
Alexander Clouter, alex@digriz.org.uk
Copyright (C) 2004 University of Southampton
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.005 or, at your option, any later version of Perl 5 you may have available.
|
Net::SDP::Time - Time Description in an SDP file |