Re: Trouble with time

2006-11-28 Thread Zefram
Stupid trick to make it do the magic Rafael expected: #!/usr/bin/perl use warnings; use strict; { package Tied_Strftime; sub TIESCALAR { my($class, $fmt) = @_; return bless(\$fmt, $class); } sub FETCH { use DateTime;

Re: Trouble with time

2006-11-28 Thread Zefram
Rafael Morales wrote: >Why the seconds and milliseconds do not change ?? How can I do it to >work fine ??? Your program looks up the current time once, at the start. It then repeatedly prints out that one time. $time never changes. You want to move the call to time() inside the loop, so tha

Trouble with time

2006-11-28 Thread Rafael Morales
Hi list: I have this: #!/usr/bin/perl use strict; use warnings; use DateTime; use Time::HiRes qw( time ); my $dt = DateTime->from_epoch( epoch => time() ); my $time = $dt->strftime( '%Y-%m-%d %H:%M:%S.%3N' ); while ( $time ) { print "$time\n"; } And this is this the outpu: 2006-11-28