ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/digital-clock
(Generate patch)

Comparing rxvt-unicode/src/perl/digital-clock (file contents):
Revision 1.6 by root, Tue Jan 3 04:30:31 2006 UTC vs.
Revision 1.10 by root, Sun Jun 10 17:31:53 2012 UTC

1#! perl 1#! perl
2 2
3# this creates a simple digital clock 3=head1 NAME
4 4
5sub on_init { 5 digital-clock - display a digital clock overlay
6
7=head1 DESCRPTION
8
9Displays a digital clock using the built-in overlay.
10
11=cut
12
13sub on_start {
6 my ($self) = @_; 14 my ($self) = @_;
7 15
8 $self->{digital_clock_overlay} = $self->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0); 16 $self->{overlay} = $self->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0);
9 $self->{digital_clock_timer} = urxvt::timer 17 $self->{timer} = urxvt::timer
10 ->new 18 ->new
11 ->start (int urxvt::NOW) # make sure we update "on" the second 19 ->start (1 + int urxvt::NOW) # make sure we update "on" the second
12 ->interval (1) 20 ->interval (1)
13 ->cb (sub { 21 ->cb (sub {
14 $self->{digital_clock_overlay}->set (0, 0, 22 $self->{overlay}->set (0, 0,
15 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); 23 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
16 }); 24 });
17 25
18 () 26 ()
19} 27}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines