12345678910111213141516171819202122232425262728293031323334353637 |
- #!/usr/bin/perl -w
-
- ## Author: Alois Mahdal at zxcvb cz
- # just measuring one second.
-
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
-
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
-
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- use warnings;
-
- use Time::HiRes qw|time|;
- use POSIX qw|modf|;
-
- sub stamp {
- my $time = shift;
- my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = (localtime($time));
- return sprintf "%04i-%02i-%02i %02i:%02i:%02i.%05i",
- $year + 1900, $mon + 1, $mday,
- $hour, $min, $sec, ( modf $time)[0] * 100000;
- }
-
-
- while (1) {
- print stamp Time::HiRes::time();
- print "\n";
- sleep 1;
- }
|