mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 01:40:05 +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_ =
|
||||
scwx::util::TimeString(context()->radarProductView_->sweep_time(),
|
||||
std::chrono::current_zone());
|
||||
std::chrono::current_zone(),
|
||||
false);
|
||||
p->sweepTimeNeedsUpdate_ = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ std::chrono::system_clock::time_point TimePoint(uint16_t modifiedJulianDate,
|
|||
uint32_t milliseconds);
|
||||
|
||||
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 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,
|
||||
const std::chrono::time_zone* timeZone)
|
||||
const std::chrono::time_zone* timeZone,
|
||||
bool epochValid)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
auto timeInSeconds = time_point_cast<seconds>(time);
|
||||
std::ostringstream os;
|
||||
|
||||
if (timeZone != nullptr)
|
||||
if (epochValid || time.time_since_epoch().count() != 0)
|
||||
{
|
||||
zoned_time zt = {current_zone(), timeInSeconds};
|
||||
os << zt;
|
||||
}
|
||||
else
|
||||
{
|
||||
os << timeInSeconds;
|
||||
if (timeZone != nullptr)
|
||||
{
|
||||
zoned_time zt = {current_zone(), timeInSeconds};
|
||||
os << zt;
|
||||
}
|
||||
else
|
||||
{
|
||||
os << timeInSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue