Added support for format override to format_time()

This commit is contained in:
Chris 2011-11-16 16:29:24 +00:00
parent 1bf2f9dc76
commit 9672548f97

View File

@ -508,17 +508,21 @@ sub get_bbcode_path {
}
## @method $ format_time($time)
## @method $ format_time($time, $format)
# Given a time un unix timestamp format (seconds since the epoc), create a formatted
# date string.
#
# @param $time The time to format.
# @param time The time to format.
# @param format Optional format string, if not set the default format is used.
# @return The string containing the formatted time.
sub format_time {
my $self = shift;
my $time = shift;
my $self = shift;
my $time = shift;
my $format = shift;
# Fall back on the default if the user has not set a format.
$format = $self -> {"timefmt"} if(!defined($format));
return strftime($self -> {"timefmt"}, localtime($time));
return strftime($format, localtime($time));
}