diff --git a/src/ReportDialog.cpp b/src/ReportDialog.cpp index ac64f930..ac095aba 100644 --- a/src/ReportDialog.cpp +++ b/src/ReportDialog.cpp @@ -77,9 +77,9 @@ void ReportDialog::SetRouteMapOverlays(std::list routemapoverl page += _("Boat Filename") + _T(" ") + wxFileName(c.boatFileName).GetName() + _T("
"); page += _("Route from ") + c.Start + _(" to ") + c.End + _T("
"); - page += _("Leaving ") + (*it)->StartTime().Format(_T("%x %X")) + _T("
"); + page += _("Leaving ") + FormatTime((*it)->StartTime()) + _T("
"); if (d) { - page += _("Arriving ") + (*it)->EndTime().Format(_T("%x %X")) + _T("
"); + page += _("Arriving ") + FormatTime((*it)->EndTime()) + _T("
"); page += _("Duration ") + ((*it)->EndTime() - (*it)->StartTime()).Format() + _T("
"); } page += _T("

"); @@ -147,6 +147,27 @@ void ReportDialog::SetRouteMapOverlays(std::list routemapoverl m_htmlConfigurationReport->SetPage(page); } +wxDateTime ReportDialog::DisplayedTime(wxDateTime t) +{ + wxDateTime display_time = t; + if(m_WeatherRouting.m_SettingsDialog.m_cbUseLocalTime->GetValue()) + display_time = t.FromUTC(); + return display_time; +} + +wxString ReportDialog::FormatTime(wxDateTime t) +{ + wxString r = DisplayedTime(t).Format(_T("%x %X")); +#if 0 + // XXX add this? + if(m_WeatherRouting.m_SettingsDialog.m_cbUseLocalTime->GetValue()) + r += _(" (local)"); + else + r += _T(" (UTC)"); +#endif + return r; +} + void ReportDialog::GenerateRoutesReport() { if(!m_bReportStale) @@ -213,7 +234,7 @@ void ReportDialog::GenerateRoutesReport() } } - page += _("

Fastest configuration ") + fastest->StartTime().Format(_T("%x %X")); + page += _("
Fastest configuration ") + FormatTime(fastest->StartTime()); page += wxString(_T(" ")) + _("avg speed") + wxString::Format (_T(": %.2f "), fastest->RouteInfo(RouteMapOverlay::AVGSPEED)) + _("knots"); @@ -247,8 +268,8 @@ void ReportDialog::GenerateRoutesReport() break; RouteMapOverlay *r = it->second; - wxDateTime s = r->StartTime(); - wxDateTime e = r->EndTime(); + wxDateTime s = DisplayedTime(r->StartTime()); + wxDateTime e = DisplayedTime(r->EndTime()); // merge downwind for(; it != sort_by_start.end(); it++) { RouteMapOverlay *r = it->second; @@ -283,7 +304,7 @@ void ReportDialog::GenerateRoutesReport() } page += RouteMapOverlay::sailingConditionText(best_sailing_comfort); page += _T(" on "); - page += best_comfort_date.Format(_T("%x %X")) + _T(" UTC"); + page += FormatTime(best_comfort_date); page += _T("
"); page += _("Cyclones") + wxString(_T(": ")); @@ -354,7 +375,7 @@ void ReportDialog::GenerateRoutesReport() if(!first) page += _(" and "); first = false; - page += (*it2)->StartTime().Format(_T("%x")); + page += DisplayedTime((*it2)->StartTime()).Format(_T("%x")); if(++it2 == cyclone_safe_routes.end()) break; @@ -365,7 +386,7 @@ void ReportDialog::GenerateRoutesReport() while(*it2 && ++it2 != cyclone_safe_routes.end()); it2--; - page += _(" to ") + (*it2)->StartTime().Format(_T("%x")); + page += _(" to ") + DisplayedTime((*it2)->StartTime()).Format(_T("%x")); } } cyclonesfailed:; diff --git a/src/ReportDialog.h b/src/ReportDialog.h index 7cc3f0c9..1840bb83 100644 --- a/src/ReportDialog.h +++ b/src/ReportDialog.h @@ -42,6 +42,7 @@ class ReportDialog : public ReportDialogBase void OnClose( wxCommandEvent& event ) { Hide(); } private: - + wxDateTime DisplayedTime(wxDateTime t); + wxString FormatTime(wxDateTime t); WeatherRouting &m_WeatherRouting; }; diff --git a/src/WeatherRouting.cpp b/src/WeatherRouting.cpp index 5a87ec02..f0fbf262 100644 --- a/src/WeatherRouting.cpp +++ b/src/WeatherRouting.cpp @@ -2170,19 +2170,22 @@ void WeatherRouting::Export(RouteMapOverlay &routemapoverlay) { std::list plotdata = routemapoverlay.GetPlotData(false); - if(plotdata.size() == 0) { + if(plotdata.empty()) { wxMessageDialog mdlg(this, _("Empty Route, nothing to export\n"), _("Weather Routing"), wxOK | wxICON_WARNING); mdlg.ShowModal(); return; } - // XXX double check time is really end time, not start time off by one. - RouteMapConfiguration c = routemapoverlay.GetConfiguration(); - PlugIn_Track* newTrack = new PlugIn_Track; - newTrack->m_NameString = _("Weather Route") + " (" + c.Start + ")"; + wxDateTime display_time = routemapoverlay.StartTime(); + if(m_SettingsDialog.m_cbUseLocalTime->GetValue()) + display_time = display_time.FromUTC(); + + newTrack->m_NameString = _("Weather Route ") + " (" +display_time.Format(_T("%x %H:%M")) + ")"; + // XXX double check time is really end time, not start time off by one. + RouteMapConfiguration c = routemapoverlay.GetConfiguration(); for(std::list::iterator it = plotdata.begin(); it != plotdata.end(); it++) { PlugIn_Waypoint* newPoint = new PlugIn_Waypoint