@@ -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}
64
64
my $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"
65
65
my $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])/ ;
66
66
my $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]"
68
68
my $raw_postfix_match = qr /\. btrfs(\. ($compress_format_alt ))?(\. (gpg|encrypted))?/ ; # matches ".btrfs[.gz|.bz2|.xz|...][.gpg|.encrypted]"
69
69
my $safe_file_match = qr / [0-9a-zA-Z_@\+\-\.\/ ]+/ ; # note: ubuntu uses '@' in the subvolume layout: <https://help.ubuntu.com/community/btrfs>
70
70
@@ -82,7 +82,7 @@ my %config_options = (
82
82
# NOTE: the parser always maps "no" to undef
83
83
# NOTE: keys "volume", "subvolume" and "target" are hardcoded
84
84
# 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 ) ] },
86
86
snapshot_dir => { default => undef , accept_file => { relative => 1, absolute => 1 }, context => [qw( global volume subvolume ) ] },
87
87
snapshot_name => { c_default => 1, accept_file => { name_only => 1 }, context => [qw( subvolume ) ], deny_glob_context => 1 }, # NOTE: defaults to the subvolume name (hardcoded)
88
88
snapshot_create => { default => " always" , accept => [qw( no always ondemand onchange ) ], context => [qw( global volume subvolume ) ] },
@@ -4834,6 +4834,9 @@ sub timestamp($$;$)
4834
4834
elsif ($format eq " debug-iso" ) {
4835
4835
$ts = sprintf (' %04u-%02u-%02uT%02u:%02u:%02u' , $tm [5] + 1900, $tm [4] + 1, $tm [3], $tm [2], $tm [1], $tm [0]);
4836
4836
}
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
+ }
4837
4840
else { die ; }
4838
4841
4839
4842
if ($tm_is_utc ) {
0 commit comments