mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 04:10:06 +00:00
Don't display epoch on map overlay
This commit is contained in:
parent
7c44bafeb5
commit
78a16b6a99
3 changed files with 16 additions and 10 deletions
|
|
@ -103,7 +103,8 @@ void OverlayLayer::Render(const QMapbox::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
p->sweepTimeString_ =
|
p->sweepTimeString_ =
|
||||||
scwx::util::TimeString(context()->radarProductView_->sweep_time(),
|
scwx::util::TimeString(context()->radarProductView_->sweep_time(),
|
||||||
std::chrono::current_zone());
|
std::chrono::current_zone(),
|
||||||
|
false);
|
||||||
p->sweepTimeNeedsUpdate_ = false;
|
p->sweepTimeNeedsUpdate_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ std::chrono::system_clock::time_point TimePoint(uint16_t modifiedJulianDate,
|
||||||
uint32_t milliseconds);
|
uint32_t milliseconds);
|
||||||
|
|
||||||
std::string TimeString(std::chrono::system_clock::time_point time,
|
std::string TimeString(std::chrono::system_clock::time_point time,
|
||||||
const std::chrono::time_zone* timeZone = nullptr);
|
const std::chrono::time_zone* timeZone = nullptr,
|
||||||
|
bool epochValid = true);
|
||||||
|
|
||||||
} // namespace util
|
} // namespace util
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -22,20 +22,24 @@ std::chrono::system_clock::time_point TimePoint(uint16_t modifiedJulianDate,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TimeString(std::chrono::system_clock::time_point time,
|
std::string TimeString(std::chrono::system_clock::time_point time,
|
||||||
const std::chrono::time_zone* timeZone)
|
const std::chrono::time_zone* timeZone,
|
||||||
|
bool epochValid)
|
||||||
{
|
{
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
auto timeInSeconds = time_point_cast<seconds>(time);
|
auto timeInSeconds = time_point_cast<seconds>(time);
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
|
||||||
if (timeZone != nullptr)
|
if (epochValid || time.time_since_epoch().count() != 0)
|
||||||
{
|
{
|
||||||
zoned_time zt = {current_zone(), timeInSeconds};
|
if (timeZone != nullptr)
|
||||||
os << zt;
|
{
|
||||||
}
|
zoned_time zt = {current_zone(), timeInSeconds};
|
||||||
else
|
os << zt;
|
||||||
{
|
}
|
||||||
os << timeInSeconds;
|
else
|
||||||
|
{
|
||||||
|
os << timeInSeconds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return os.str();
|
return os.str();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue