ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/digital-clock
Revision: 1.8
Committed: Wed Jan 18 11:05:09 2006 UTC (18 years, 4 months ago) by root
Branch: MAIN
CVS Tags: rel-7_2, rel-7_1
Changes since 1.7: +1 -1 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #! perl
2
3 # this creates a simple digital clock
4
5 sub on_init {
6 my ($self) = @_;
7
8 $self->{overlay} = $self->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0);
9 $self->{timer} = urxvt::timer
10 ->new
11 ->start (1 + int urxvt::NOW) # make sure we update "on" the second
12 ->interval (1)
13 ->cb (sub {
14 $self->{overlay}->set (0, 0,
15 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
16 });
17
18 ()
19 }
20
21