mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-11 20:39:06 +08:00
Update the [timestamp] placeholder(s) at every G-code export. #1957
This commit is contained in:
parent
f7ffc48397
commit
6780e930cb
@ -12,7 +12,13 @@ sub BUILD {
|
|||||||
# environment variables
|
# environment variables
|
||||||
$s->{$_} = $ENV{$_} for grep /^SLIC3R_/, keys %ENV;
|
$s->{$_} = $ENV{$_} for grep /^SLIC3R_/, keys %ENV;
|
||||||
|
|
||||||
# timestamp
|
$self->update_timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub update_timestamp {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
my $s = $self->_single;
|
||||||
my @lt = localtime; $lt[5] += 1900; $lt[4] += 1;
|
my @lt = localtime; $lt[5] += 1900; $lt[4] += 1;
|
||||||
$s->{timestamp} = sprintf '%04d%02d%02d-%02d%02d%02d', @lt[5,4,3,2,1,0];
|
$s->{timestamp} = sprintf '%04d%02d%02d-%02d%02d%02d', @lt[5,4,3,2,1,0];
|
||||||
$s->{year} = $lt[5];
|
$s->{year} = $lt[5];
|
||||||
|
@ -839,7 +839,7 @@ sub write_gcode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# prepare the helper object for replacing placeholders in custom G-code and output filename
|
# prepare the helper object for replacing placeholders in custom G-code and output filename
|
||||||
|
$self->placeholder_parser->update_timestamp;
|
||||||
|
|
||||||
# set up our helper object
|
# set up our helper object
|
||||||
my $gcodegen = Slic3r::GCode->new(
|
my $gcodegen = Slic3r::GCode->new(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user