mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 01:25:56 +08:00
Always format month/day/hour/second/minute placeholder variables out to their full width.
Fixes #4019
This commit is contained in:
parent
9f0335b4b8
commit
5e7fbe177d
@ -37,23 +37,43 @@ PlaceholderParser::update_timestamp()
|
||||
time(&rawtime);
|
||||
struct tm* timeinfo = localtime(&rawtime);
|
||||
|
||||
this->set("year", 1900 + timeinfo->tm_year);
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << std::setw(2) << std::setfill('0') << (1 + timeinfo->tm_mon);
|
||||
this->set("month", ss.str());
|
||||
}
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_mday;
|
||||
this->set("day", ss.str());
|
||||
}
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_hour;
|
||||
this->set("hour", ss.str());
|
||||
}
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_min;
|
||||
this->set("minute", ss.str());
|
||||
}
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_sec;
|
||||
this->set("second", ss.str());
|
||||
}
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << (1900 + timeinfo->tm_year);
|
||||
ss << std::setw(2) << std::setfill('0') << (1 + timeinfo->tm_mon);
|
||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_mday;
|
||||
ss << this->_single["month"];
|
||||
ss << this->_single["day"];
|
||||
ss << "-";
|
||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_hour;
|
||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_min;
|
||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_sec;
|
||||
ss << this->_single["hour"];
|
||||
ss << this->_single["minute"];
|
||||
ss << this->_single["second"];
|
||||
this->set("timestamp", ss.str());
|
||||
}
|
||||
this->set("year", 1900 + timeinfo->tm_year);
|
||||
this->set("month", 1 + timeinfo->tm_mon);
|
||||
this->set("day", timeinfo->tm_mday);
|
||||
this->set("hour", timeinfo->tm_hour);
|
||||
this->set("minute", timeinfo->tm_min);
|
||||
this->set("second", timeinfo->tm_sec);
|
||||
}
|
||||
|
||||
void PlaceholderParser::apply_config(const DynamicPrintConfig &config)
|
||||
|
Loading…
x
Reference in New Issue
Block a user