Просмотр исходного кода

Update iso8601 to output non : separated times

cray
Mitch Tishmack 10 лет назад
Родитель
Сommit
4585dc1cc0
1 измененных файлов: 11 добавлений и 4 удалений
  1. +11
    -4
      bin.org

+ 11
- 4
bin.org Просмотреть файл

@@ -655,12 +655,19 @@ generally without depending on gnu date.
use strict;
use warnings;
use POSIX qw(strftime);
use Getopt::Long;

my $short = 0;
GetOptions('short' => \$short,
's' => \$short
);

my $now = time;
my $tz = strftime(('%z', (localtime $now)));
$tz =~ s/(\d{2})(\d{2})/$1:$2/smx;
my $time = strftime('%Y-%m-%dT%H:%M:%S', (localtime $now));
print "$time$tz\n";
if ($short) {
print strftime('%Y%m%dT%H%M%SZ', (gmtime $now)) . "\n";
} else {
print strftime('%Y-%m-%dT%H:%M:%SZ', (gmtime $now)) . "\n";
}
exit 0;
#+END_SRC



Загрузка…
Отмена
Сохранить