<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">$Tk::LabelTimer::VERSION = 1.0;
package Tk::LabelTimer;

use base qw(Tk::LabelFmt);

use strict;

Construct Tk::Widget 'LabelTimer';

sub ClassInit {
    my ($class, $mw) = @_;
    $class-&gt;Tk::LabelFmt::ClassInit($mw);
}
sub Populate {
    my ($w, $args) = @_;
    $w-&gt;Tk::LabelFmt::Populate($args);
    $w-&gt;ConfigSpecs(
		    -undefstring =&gt;  [qw/PASSIVE undefstring UndefString/, "--:--:--.--"],
		    -formatcmd =&gt;    [qw/CALLBACK formatCmd FormatCmd /, \&amp;FormatCmdTimer],
		    );
}
sub FormatCmdTimer {
    my ($w, $val) = @_;
    return $w-&gt;cget('-undefstring') if (!defined $val);
    my $fmt = $w-&gt;cget('-format');
    my ($hr, $min, $sec) = (localtime($val))[2,1,0];
    my $fsec = $val - int ($val);
    return sprintf("%02d:%02d:%05.2f", $hr, $min, $sec+$fsec);
}
sub Configured { Tk::LabelFmt::Configured(@_) }
1;
__END__

=head1 NAME
Tk::LabelTimer - Print variables in a label in a clock format.

=head1 SYNOPSIS

S&lt;    &gt;I&lt;$lo&gt; = I&lt;$parent&gt;-E&lt;gt&gt;B&lt;LabelTimer&gt;(I&lt;-option&gt; =E&lt;gt&gt; I&lt;value&gt;, ... );

=head1 DESCRIPTION

This widget is derived from LabelFmt and contains additional options for formatting time
values. The same options that are abailable for LabelFmt are available here.


=over 4

=item B&lt;Label options&gt;

LabelTimer takes all valid options of Tk::Label;

=item B&lt;LabelFmt options&gt;

LabelTimer takes all valid options of Tk::LabelFmt;

=back

=head1 METHODS

None.

=head1 ADVERTISED WIDGETS

None.

=head1 EXAMPLES

my $timevar = time;    
I&lt;$lo&gt; = I&lt;$mw&gt;-E&lt;gt&gt;B&lt;LabelTimer&gt;(-textvariable =E&lt;gt&gt; \$timevar);

=head1 AUTHOR

viosca@imageman.com

This program is free software; you can redistribute it andor modify it and/ormodify it 
under the same terms as Perl itself.

=head1 SEE ALSO

L&lt;Tk::LabelFmt|Tk::LabelFmt&gt;
L&lt;Tk::LabelWgs|Tk::LabelWgs&gt;

=cut
</pre></body></html>