void CGUIWindowPVRGuide::GetViewTimelineItems(CFileItemList &items)
{
  CGUIEPGGridContainer* epgGridContainer = dynamic_cast<CGUIEPGGridContainer*>(GetControl(m_viewControl.GetCurrentControl()));
  if (!epgGridContainer)
    return;

  CPVRChannelGroupPtr group;
  {
    CSingleLock lock(m_critSection);

    // group change detected reset grid coordinates and refresh grid items
    if (!m_bRefreshTimelineItems && *m_cachedChannelGroup != *GetGroup())
    {
      epgGridContainer->ResetCoordinates();
      m_bRefreshTimelineItems = true;
      RefreshTimelineItems();
    }

    if (m_newTimeline != nullptr)
    {
      m_cachedTimeline = m_newTimeline;
      m_newTimeline.reset();
    }

    items.Clear();
    items.RemoveDiscCache(GetID());
    items.Assign(*m_cachedTimeline, false);

    group = m_cachedChannelGroup;
  }

  CDateTime startDate(group->GetFirstEPGDate());
  CDateTime endDate(group->GetLastEPGDate());
  CDateTime currentDate = CDateTime::GetCurrentDateTime().GetAsUTCDateTime();

  if (!startDate.IsValid())
    startDate = currentDate;

  if (!endDate.IsValid() || endDate < startDate)
    endDate = startDate;

  // limit start to linger time
  CDateTime maxPastDate = currentDate - CDateTimeSpan(0, 0, g_advancedSettings.m_iEpgLingerTime, 0);
  if (startDate < maxPastDate)
    startDate = maxPastDate;

  epgGridContainer->SetStartEnd(startDate, endDate);
}