From 32406e9d02199f5149d2e6194a2a68c11a30f635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Ga=C5=82=C4=85zka?= Date: Sat, 1 Nov 2014 20:28:46 +0100 Subject: [PATCH] Jump to latest data fix * Fix for amd64 in jump to latest data broke search on i386 due to time_t overflow. This version works on both platforms. --- wx/draw3/drawsctrl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wx/draw3/drawsctrl.cpp b/wx/draw3/drawsctrl.cpp index 2463e5343..87e1d5b6d 100644 --- a/wx/draw3/drawsctrl.cpp +++ b/wx/draw3/drawsctrl.cpp @@ -94,7 +94,11 @@ void DrawsController::DisplayState::MoveScreenRight() { void DrawsController::DisplayState::GoToLatestDate() { const TimeIndex& index = m_c->m_draws[m_c->m_selected_draw]->GetTimeIndex(); - wxDateTime t = wxDateTime(31, wxDateTime::Dec, 0xffff, 23, 59, 59) + + // problem with 32bit time_t + int year = sizeof(time_t) == 8 ? 0xffff : 2037; + + wxDateTime t = wxDateTime(31, wxDateTime::Dec, year, 23, 59, 59) - index.GetTimeRes() - index.GetDateRes(); m_c->EnterState(SEARCH_LEFT, DTime(m_c->GetPeriod(), t));