Audio::MPD::Common::Time - class representing time of current song
my $time = $status->time;
print $time->sofar;
Audio::MPD::Common::Status returns some time information with the time()
accessor. This information relates to the elapsed time of the current song,
as well as the remaining and total time. This information is encapsulated
in an Audio::MPD::Common::Time object.
Note that an Audio::MPD::Common::Time object does not update itself
regularly, and thus should be used immediately.
The new() method is the constructor for the Audio::MPD::Common::Time
class.
Note: one should never ever instantiate an Audio::MPD::Common::Time
object directly - use the mpd modules instead.
Once created, one can access the following members of the object:
The sofar(), left() and total() methods return the according values
under the form minutes:seconds. Note the existence of a percent()
method returning a percentage complete. (one decimal)
The seconds_sofar(), seconds_left() and seconds_total() return the
according values in seconds.
If you want to cook your own value, then the following methods can help:
sofar_secs() and sofar_mins() return the seconds and minutes elapsed.
Same for left_secs() and left_mins() (time remaining), total_secs()
and total_mins(). (total song length)
Please note that those accessors are read-only: changing a value will not change the current settings of MPD server. Use the mpd modules to alter the settings.
Jerome Quelin, <jquelin at cpan.org>
Copyright (c) 2007 Jerome Quelin, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.