wxDateTime ReportDialog::DisplayedTime(wxDateTime t) { wxDateTime display_time = t; if(m_WeatherRouting.m_SettingsDialog.m_cbUseLocalTime->GetValue()) display_time = t.FromUTC(); return display_time; }
void ConfigurationDialog::SetStartDateTime(wxDateTime datetime) { if(datetime.IsValid()) { if(m_WeatherRouting.m_SettingsDialog.m_cbUseLocalTime->GetValue()) datetime = datetime.FromUTC(); m_dpStartDate->SetValue(datetime); m_tStartHour->SetValue(wxString::Format(_T("%.3f"), datetime.GetHour() +datetime.GetMinute() / 60.0)); } else { wxMessageDialog mdlg(this, _("Invalid Date Time."), wxString(_("Weather Routing"), wxOK | wxICON_WARNING)); mdlg.ShowModal(); } }
void ConfigurationDialog::SetStartDateTime(wxDateTime datetime) { if(datetime.IsValid()) { if(m_WeatherRouting.m_SettingsDialog.m_cbUseLocalTime->GetValue()) datetime = datetime.FromUTC(); m_dpStartDate->SetValue(datetime); m_tpTime->SetValue(datetime); m_edited_controls.push_back(m_tpTime); m_edited_controls.push_back(m_dpStartDate); } else { wxMessageDialog mdlg(this, _("Invalid Date Time."), wxString(_("Weather Routing"), wxOK | wxICON_WARNING)); mdlg.ShowModal(); } }
wxString timestamp2s(wxDateTime ts, int tz_selection, long LMT_offset, int format) { wxString s = _T(""); wxString f; if (format == INPUT_FORMAT) f = _T("%m/%d/%Y %H:%M"); else if (format == TIMESTAMP_FORMAT) f = _T("%m/%d/%Y %H:%M:%S"); else f = _T(" %m/%d %H:%M"); switch (tz_selection) { case 0: s.Append(ts.Format(f)); if (format != INPUT_FORMAT) s.Append(_T(" UT")); break; case 1: s.Append(ts.FromUTC().Format(f)); break; case 2: wxTimeSpan lmt(0,0,(int)LMT_offset,0); s.Append(ts.Add(lmt).Format(f)); if (format != INPUT_FORMAT) s.Append(_T(" LMT")); } return(s); }