@@ -64,7 +64,7 @@ my $ipv4_addr_match = qr/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}
6464my $ipv6_addr_match = qr / [a-fA-F0-9]*:[a-fA-F0-9]*:[a-fA-F0-9:]+/ ; # simplified (contains at least two colons), matches "::1", "2001:db8::7"
6565my $host_name_match = qr / (([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\- ]*[a-zA-Z0-9])\. )*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\- ]*[A-Za-z0-9])/ ;
6666my $uuid_match = qr / [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ ;
67- my $btrbk_timestamp_match = qr / (?<YYYY>[0-9]{4})(?<MM>[0-9]{2})(?<DD>[0-9]{2})(T (?<hh>[0-9]{2})(?<mm>[0-9]{2})((?<ss>[0-9]{2})(?<zz>(Z|[+-][0-9]{4})))?)?(_(?<NN>[0-9]+))?/ ; # matches "YYYYMMDD[Thhmm[ss+0000]][_NN]"
67+ my $btrbk_timestamp_match = qr / (?<YYYY>[0-9]{4})-? (?<MM>[0-9]{2})-? (?<DD>[0-9]{2})_?(T? (?<hh>[0-9]{2})-? (?<mm>[0-9]{2})((?<ss>[0-9]{2})(?<zz>(Z|[+-][0-9]{4})))?)?(_(?<NN>[0-9]+))? ?/ ; # matches "YYYYMMDD[Thhmm[ss+0000]][_NN]"
6868my $raw_postfix_match = qr /\. btrfs(\. ($compress_format_alt ))?(\. (gpg|encrypted))?/ ; # matches ".btrfs[.gz|.bz2|.xz|...][.gpg|.encrypted]"
6969my $safe_file_match = qr / [0-9a-zA-Z_@\+\-\.\/ ]+/ ; # note: ubuntu uses '@' in the subvolume layout: <https://help.ubuntu.com/community/btrfs>
7070
@@ -82,7 +82,7 @@ my %config_options = (
8282 # NOTE: the parser always maps "no" to undef
8383 # NOTE: keys "volume", "subvolume" and "target" are hardcoded
8484 # NOTE: files "." and "no" map to <undef>
85- timestamp_format => { default => " long" , accept => [qw( short long long-iso ) ], context => [qw( global volume subvolume ) ] },
85+ timestamp_format => { default => " long" , accept => [qw( short long long-iso human ) ], context => [qw( global volume subvolume ) ] },
8686 snapshot_dir => { default => undef , accept_file => { relative => 1, absolute => 1 }, context => [qw( global volume subvolume ) ] },
8787 snapshot_name => { c_default => 1, accept_file => { name_only => 1 }, context => [qw( subvolume ) ], deny_glob_context => 1 }, # NOTE: defaults to the subvolume name (hardcoded)
8888 snapshot_create => { default => " always" , accept => [qw( no always ondemand onchange ) ], context => [qw( global volume subvolume ) ] },
@@ -4834,6 +4834,9 @@ sub timestamp($$;$)
48344834 elsif ($format eq " debug-iso" ) {
48354835 $ts = sprintf (' %04u-%02u-%02uT%02u:%02u:%02u' , $tm [5] + 1900, $tm [4] + 1, $tm [3], $tm [2], $tm [1], $tm [0]);
48364836 }
4837+ elsif ($format eq " human" ) {
4838+ return sprintf (' %04u-%02u-%02u_%02u-%02u' , $tm [5] + 1900, $tm [4] + 1, $tm [3], $tm [2], $tm [1]);
4839+ }
48374840 else { die ; }
48384841
48394842 if ($tm_is_utc ) {
0 commit comments