Add option --mssafe to isodate
MS OSs don't like ":" in filenames (and Samba's scrambling algorithm makes filenames with it completely unrecognizable), so I added an option to use a less dangerous character ("-") in the time part. "." would have been nicer and technically possible but that's used to delimit extensions, so that might have had surprising consequences, too. Just omitting the delimiter and squashing HHMMSS together isn't very readable.
This commit is contained in:
parent
be21bc6ff8
commit
2209823843
16
tiny/isodate
16
tiny/isodate
|
@ -1,2 +1,14 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/perl
|
||||||
date '+%Y-%m-%dT%H:%M:%S'
|
use v5.10;
|
||||||
|
use warnings;
|
||||||
|
use strict;
|
||||||
|
use Getopt::Long;
|
||||||
|
use POSIX qw(strftime);
|
||||||
|
use Pod::Usage;
|
||||||
|
my $mssafe;
|
||||||
|
GetOptions(
|
||||||
|
"mssafe" => \$mssafe
|
||||||
|
) or pod2usage(1);
|
||||||
|
|
||||||
|
my $fmt = $mssafe ? "%Y-%m-%dT%H-%M-%S" : "%Y-%m-%dT%H:%M:%S";
|
||||||
|
say strftime($fmt, localtime);
|
||||||
|
|
Loading…
Reference in New Issue