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 that it looks up the current time each time round: while(1) { my $dt = DateTime->from_epoch( epoch => time() ); my $time = $dt->strftime( '%Y-%m-%d %H:%M:%S.%3N' ); print "$time\n"; } -zefram