mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 01:15:52 +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
@ -36,24 +36,44 @@ PlaceholderParser::update_timestamp()
|
|||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
time(&rawtime);
|
time(&rawtime);
|
||||||
struct tm* timeinfo = localtime(&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;
|
std::ostringstream ss;
|
||||||
ss << (1900 + timeinfo->tm_year);
|
ss << (1900 + timeinfo->tm_year);
|
||||||
ss << std::setw(2) << std::setfill('0') << (1 + timeinfo->tm_mon);
|
ss << this->_single["month"];
|
||||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_mday;
|
ss << this->_single["day"];
|
||||||
ss << "-";
|
ss << "-";
|
||||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_hour;
|
ss << this->_single["hour"];
|
||||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_min;
|
ss << this->_single["minute"];
|
||||||
ss << std::setw(2) << std::setfill('0') << timeinfo->tm_sec;
|
ss << this->_single["second"];
|
||||||
this->set("timestamp", ss.str());
|
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)
|
void PlaceholderParser::apply_config(const DynamicPrintConfig &config)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user