mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-29 23:10:06 +00:00 
			
		
		
		
	Update most instances of current time to use a time offset
This commit is contained in:
		
							parent
							
								
									e0a4dee72b
								
							
						
					
					
						commit
						bd27d0e562
					
				
					 19 changed files with 48 additions and 38 deletions
				
			
		|  | @ -4,6 +4,7 @@ | |||
| #include <scwx/qt/util/texture_atlas.hpp> | ||||
| #include <scwx/qt/util/tooltip.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <execution> | ||||
| 
 | ||||
|  | @ -313,7 +314,7 @@ void GeoIcons::Render(const QMapLibre::CustomLayerRenderParameters& params, | |||
|       // Selected time
 | ||||
|       std::chrono::system_clock::time_point selectedTime = | ||||
|          (p->selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|             std::chrono::system_clock::now() : | ||||
|             scwx::util::time::now() : | ||||
|             p->selectedTime_; | ||||
|       glUniform1i( | ||||
|          p->uSelectedTimeLocation_, | ||||
|  | @ -930,7 +931,7 @@ bool GeoIcons::RunMousePicking( | |||
|    // If no time has been selected, use the current time
 | ||||
|    std::chrono::system_clock::time_point selectedTime = | ||||
|       (p->selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|          std::chrono::system_clock::now() : | ||||
|          scwx::util::time::now() : | ||||
|          p->selectedTime_; | ||||
| 
 | ||||
|    // For each pickable icon
 | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ | |||
| #include <scwx/qt/util/maplibre.hpp> | ||||
| #include <scwx/qt/util/tooltip.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <execution> | ||||
| 
 | ||||
|  | @ -284,7 +285,7 @@ void GeoLines::Render(const QMapLibre::CustomLayerRenderParameters& params) | |||
|       // Selected time
 | ||||
|       std::chrono::system_clock::time_point selectedTime = | ||||
|          (p->selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|             std::chrono::system_clock::now() : | ||||
|             scwx::util::time::now() : | ||||
|             p->selectedTime_; | ||||
|       glUniform1i( | ||||
|          p->uSelectedTimeLocation_, | ||||
|  | @ -723,7 +724,7 @@ bool GeoLines::RunMousePicking( | |||
|    // If no time has been selected, use the current time
 | ||||
|    std::chrono::system_clock::time_point selectedTime = | ||||
|       (p->selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|          std::chrono::system_clock::now() : | ||||
|          scwx::util::time::now() : | ||||
|          p->selectedTime_; | ||||
| 
 | ||||
|    // For each pickable line
 | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ | |||
| #include <scwx/qt/util/texture_atlas.hpp> | ||||
| #include <scwx/qt/util/tooltip.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <execution> | ||||
| 
 | ||||
|  | @ -295,7 +296,7 @@ void PlacefileIcons::Render( | |||
|       // Selected time
 | ||||
|       std::chrono::system_clock::time_point selectedTime = | ||||
|          (p->selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|             std::chrono::system_clock::now() : | ||||
|             scwx::util::time::now() : | ||||
|             p->selectedTime_; | ||||
|       glUniform1i( | ||||
|          p->uSelectedTimeLocation_, | ||||
|  | @ -720,7 +721,7 @@ bool PlacefileIcons::RunMousePicking( | |||
|    // If no time has been selected, use the current time
 | ||||
|    std::chrono::system_clock::time_point selectedTime = | ||||
|       (p->selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|          std::chrono::system_clock::now() : | ||||
|          scwx::util::time::now() : | ||||
|          p->selectedTime_; | ||||
| 
 | ||||
|    // For each pickable icon
 | ||||
|  |  | |||
|  | @ -2,6 +2,7 @@ | |||
| #include <scwx/qt/util/maplibre.hpp> | ||||
| #include <scwx/qt/util/texture_atlas.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <QDir> | ||||
| #include <QUrl> | ||||
|  | @ -264,7 +265,7 @@ void PlacefileImages::Render( | |||
|       // Selected time
 | ||||
|       std::chrono::system_clock::time_point selectedTime = | ||||
|          (p->selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|             std::chrono::system_clock::now() : | ||||
|             scwx::util::time::now() : | ||||
|             p->selectedTime_; | ||||
|       glUniform1i( | ||||
|          p->uSelectedTimeLocation_, | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ | |||
| #include <scwx/qt/util/maplibre.hpp> | ||||
| #include <scwx/qt/util/tooltip.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <execution> | ||||
| 
 | ||||
|  | @ -248,7 +249,7 @@ void PlacefileLines::Render( | |||
|       // Selected time
 | ||||
|       std::chrono::system_clock::time_point selectedTime = | ||||
|          (p->selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|             std::chrono::system_clock::now() : | ||||
|             scwx::util::time::now() : | ||||
|             p->selectedTime_; | ||||
|       glUniform1i( | ||||
|          p->uSelectedTimeLocation_, | ||||
|  | @ -526,7 +527,7 @@ bool PlacefileLines::RunMousePicking( | |||
|    // If no time has been selected, use the current time
 | ||||
|    std::chrono::system_clock::time_point selectedTime = | ||||
|       (p->selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|          std::chrono::system_clock::now() : | ||||
|          scwx::util::time::now() : | ||||
|          p->selectedTime_; | ||||
| 
 | ||||
|    // For each pickable line
 | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| #include <scwx/qt/gl/draw/placefile_polygons.hpp> | ||||
| #include <scwx/qt/util/maplibre.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <mutex> | ||||
| 
 | ||||
|  | @ -259,7 +260,7 @@ void PlacefilePolygons::Render( | |||
|       // Selected time
 | ||||
|       std::chrono::system_clock::time_point selectedTime = | ||||
|          (p->selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|             std::chrono::system_clock::now() : | ||||
|             scwx::util::time::now() : | ||||
|             p->selectedTime_; | ||||
|       glUniform1i( | ||||
|          p->uSelectedTimeLocation_, | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| #include <scwx/qt/util/maplibre.hpp> | ||||
| #include <scwx/qt/util/tooltip.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <fmt/format.h> | ||||
| #include <imgui.h> | ||||
|  | @ -127,7 +128,7 @@ void PlacefileText::Impl::RenderTextDrawItem( | |||
|    // If no time has been selected, use the current time
 | ||||
|    std::chrono::system_clock::time_point selectedTime = | ||||
|       (selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|          std::chrono::system_clock::now() : | ||||
|          scwx::util::time::now() : | ||||
|          selectedTime_; | ||||
| 
 | ||||
|    const bool thresholdMet = | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| #include <scwx/qt/gl/draw/placefile_triangles.hpp> | ||||
| #include <scwx/qt/util/maplibre.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <mutex> | ||||
| 
 | ||||
|  | @ -203,7 +204,7 @@ void PlacefileTriangles::Render( | |||
|       // Selected time
 | ||||
|       std::chrono::system_clock::time_point selectedTime = | ||||
|          (p->selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|             std::chrono::system_clock::now() : | ||||
|             scwx::util::time::now() : | ||||
|             p->selectedTime_; | ||||
|       glUniform1i( | ||||
|          p->uSelectedTimeLocation_, | ||||
|  |  | |||
|  | @ -2,12 +2,13 @@ | |||
| #include <scwx/qt/manager/media_manager.hpp> | ||||
| #include <scwx/qt/manager/position_manager.hpp> | ||||
| #include <scwx/qt/manager/text_event_manager.hpp> | ||||
| #include <scwx/qt/config/radar_site.hpp> | ||||
| #include <scwx/qt/settings/audio_settings.hpp> | ||||
| #include <scwx/qt/settings/general_settings.hpp> | ||||
| #include <scwx/qt/types/location_types.hpp> | ||||
| #include <scwx/qt/util/geographic_lib.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/qt/config/radar_site.hpp> | ||||
| #include <scwx/qt/settings/general_settings.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <boost/asio/post.hpp> | ||||
| #include <boost/asio/thread_pool.hpp> | ||||
|  | @ -172,7 +173,7 @@ void AlertManager::Impl::HandleAlert(const types::TextEventKey& key, | |||
| 
 | ||||
|       // If the event has ended or is inactive, or if the alert is not enabled,
 | ||||
|       // skip it
 | ||||
|       if (eventEnd < std::chrono::system_clock::now() || !alertActive || | ||||
|       if (eventEnd < scwx::util::time::now() || !alertActive || | ||||
|           !audioSettings.alert_enabled(phenomenon).GetValue()) | ||||
|       { | ||||
|          continue; | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/map.hpp> | ||||
| #include <scwx/util/threads.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| #include <scwx/wsr88d/nexrad_file_factory.hpp> | ||||
| 
 | ||||
| #include <execution> | ||||
|  | @ -821,7 +822,7 @@ void RadarProductManagerImpl::RefreshDataSync( | |||
|       auto latestTime        = providerManager->provider_->FindLatestTime(); | ||||
|       auto updatePeriod      = providerManager->provider_->update_period(); | ||||
|       auto lastModified      = providerManager->provider_->last_modified(); | ||||
|       auto sinceLastModified = std::chrono::system_clock::now() - lastModified; | ||||
|       auto sinceLastModified = scwx::util::time::now() - lastModified; | ||||
| 
 | ||||
|       // For the default interval, assume products are updated at a
 | ||||
|       // constant rate. Expect the next product at a time based on the
 | ||||
|  | @ -939,7 +940,7 @@ RadarProductManager::GetActiveVolumeTimes( | |||
|                        [&](const auto& date) | ||||
|                        { | ||||
|                           // Don't query for a time point in the future
 | ||||
|                           if (date > std::chrono::system_clock::now()) | ||||
|                           if (date > scwx::util::time::now()) | ||||
|                           { | ||||
|                              return; | ||||
|                           } | ||||
|  | @ -1259,7 +1260,7 @@ void RadarProductManagerImpl::PopulateProductTimes( | |||
|                  [&](const auto& date) | ||||
|                  { | ||||
|                     // Don't query for a time point in the future
 | ||||
|                     if (date > std::chrono::system_clock::now()) | ||||
|                     if (date > scwx::util::time::now()) | ||||
|                     { | ||||
|                        return; | ||||
|                     } | ||||
|  | @ -1556,7 +1557,7 @@ RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType, | |||
|    bool              needArchive   = true; | ||||
|    static const auto maxChunkDelay = std::chrono::minutes(10); | ||||
|    const std::chrono::system_clock::time_point firstValidChunkTime = | ||||
|       (isEpox ? std::chrono::system_clock::now() : time) - maxChunkDelay; | ||||
|       (isEpox ? scwx::util::time::now() : time) - maxChunkDelay; | ||||
| 
 | ||||
|    // See if we have this one in the chunk provider.
 | ||||
|    auto chunkFile = std::dynamic_pointer_cast<wsr88d::Ar2vFile>( | ||||
|  |  | |||
|  | @ -678,7 +678,7 @@ void TextEventManager::Impl::Refresh() | |||
|    // If the time jumps, we should attempt to load from no later than the
 | ||||
|    // previous load time
 | ||||
|    auto loadTime = | ||||
|       std::chrono::floor<std::chrono::hours>(std::chrono::system_clock::now()); | ||||
|       std::chrono::floor<std::chrono::hours>(scwx::util::time::now()); | ||||
|    auto startTime = loadTime - loadHistoryDuration_; | ||||
| 
 | ||||
|    if (prevLoadTime_ != std::chrono::sys_time<std::chrono::hours> {}) | ||||
|  |  | |||
|  | @ -218,7 +218,7 @@ void TimelineManager::AnimationStepBegin() | |||
|        p->pinnedTime_ == std::chrono::system_clock::time_point {}) | ||||
|    { | ||||
|       // If the selected view type is live, select the current products
 | ||||
|       p->SelectTimeAsync(std::chrono::system_clock::now() - p->loopTime_); | ||||
|       p->SelectTimeAsync(scwx::util::time::now() - p->loopTime_); | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|  | @ -385,8 +385,8 @@ TimelineManager::Impl::GetLoopStartAndEndTimes() | |||
|    if (viewType_ == types::MapTime::Live || | ||||
|        pinnedTime_ == std::chrono::system_clock::time_point {}) | ||||
|    { | ||||
|       endTime = std::chrono::floor<std::chrono::minutes>( | ||||
|          std::chrono::system_clock::now()); | ||||
|       endTime = | ||||
|          std::chrono::floor<std::chrono::minutes>(scwx::util::time::now()); | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|  | @ -656,8 +656,8 @@ void TimelineManager::Impl::Step(Direction direction) | |||
|    { | ||||
|       if (direction == Direction::Back) | ||||
|       { | ||||
|          newTime = std::chrono::floor<std::chrono::minutes>( | ||||
|             std::chrono::system_clock::now()); | ||||
|          newTime = | ||||
|             std::chrono::floor<std::chrono::minutes>(scwx::util::time::now()); | ||||
|       } | ||||
|       else | ||||
|       { | ||||
|  | @ -688,7 +688,7 @@ void TimelineManager::Impl::Step(Direction direction) | |||
|          newTime += 1min; | ||||
| 
 | ||||
|          // If the new time is more than 2 minutes in the future, stop stepping
 | ||||
|          if (newTime > std::chrono::system_clock::now() + 2min) | ||||
|          if (newTime > scwx::util::time::now() + 2min) | ||||
|          { | ||||
|             break; | ||||
|          } | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| #include <scwx/qt/util/color.hpp> | ||||
| #include <scwx/qt/util/tooltip.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <chrono> | ||||
| #include <mutex> | ||||
|  | @ -581,8 +582,7 @@ void AlertLayer::Impl::ScheduleRefresh() | |||
| 
 | ||||
|    // Expires at the top of the next minute
 | ||||
|    std::chrono::system_clock::time_point now = | ||||
|       std::chrono::floor<std::chrono::minutes>( | ||||
|          std::chrono::system_clock::now()); | ||||
|       std::chrono::floor<std::chrono::minutes>(scwx::util::time::now()); | ||||
|    refreshTimer_.expires_at(now + 1min); | ||||
| 
 | ||||
|    refreshTimer_.async_wait( | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ | |||
| #include <scwx/qt/types/qt_types.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/threads.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <chrono> | ||||
| #include <mutex> | ||||
|  | @ -67,7 +68,7 @@ bool AlertProxyModel::filterAcceptsRow(int                sourceRow, | |||
|                         .value<std::chrono::system_clock::time_point>(); | ||||
| 
 | ||||
|       // Compare end time to current
 | ||||
|       if (endTime < std::chrono::system_clock::now()) | ||||
|       if (endTime < scwx::util::time::now()) | ||||
|       { | ||||
|          acceptAlertActiveFilter = false; | ||||
|       } | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| #include <scwx/qt/settings/general_settings.hpp> | ||||
| #include <scwx/qt/util/time.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/util/time.hpp> | ||||
| 
 | ||||
| #include <QTimer> | ||||
| 
 | ||||
|  | @ -81,8 +82,7 @@ AnimationDockWidget::AnimationDockWidget(QWidget* parent) : | |||
|    p->timeZone_ = date::get_tzdb().locate_zone("UTC"); | ||||
| #endif | ||||
|    const std::chrono::sys_seconds currentTimePoint = | ||||
|       std::chrono::floor<std::chrono::minutes>( | ||||
|          std::chrono::system_clock::now()); | ||||
|       std::chrono::floor<std::chrono::minutes>(scwx::util::time::now()); | ||||
|    p->SetTimePoint(currentTimePoint); | ||||
| 
 | ||||
|    // Update maximum date on a timer
 | ||||
|  |  | |||
|  | @ -187,7 +187,7 @@ void OverlayProductView::Impl::LoadProduct( | |||
|                   header.date_of_message(), header.time_of_message() * 1000); | ||||
| 
 | ||||
|                // If the record is from the last 30 minutes
 | ||||
|                if (productTime + 30min >= std::chrono::system_clock::now() || | ||||
|                if (productTime + 30min >= scwx::util::time::now() || | ||||
|                    (selectedTime_ != std::chrono::system_clock::time_point {} && | ||||
|                     productTime + 30min >= selectedTime_)) | ||||
|                { | ||||
|  |  | |||
|  | @ -302,7 +302,7 @@ AwsLevel2ChunksDataProvider::Impl::GetScanTime(const std::string& prefix) | |||
|    if (scanTimeIt != scanTimes_.cend()) | ||||
|    { | ||||
|       // If the time is greater than 2 hours ago, it may be a new scan
 | ||||
|       auto replaceBy = system_clock::now() - hours {2}; | ||||
|       auto replaceBy = util::time::now() - hours {2}; | ||||
|       if (scanTimeIt->second > replaceBy) | ||||
|       { | ||||
|          return scanTimeIt->second; | ||||
|  | @ -333,8 +333,7 @@ AwsLevel2ChunksDataProvider::Impl::ListObjects() | |||
|    size_t       newObjects   = 0; | ||||
|    const size_t totalObjects = 0; | ||||
| 
 | ||||
|    const std::chrono::system_clock::time_point now = | ||||
|       std::chrono::system_clock::now(); | ||||
|    const std::chrono::system_clock::time_point now = util::time::now(); | ||||
| 
 | ||||
|    if (currentScan_.valid_ && !currentScan_.hasAllFiles_ && | ||||
|        lastTimeListed_ + std::chrono::minutes(2) > now) | ||||
|  |  | |||
|  | @ -352,7 +352,7 @@ std::pair<size_t, size_t> AwsNexradDataProvider::Refresh() | |||
| 
 | ||||
|    logger_->debug("Refresh()"); | ||||
| 
 | ||||
|    auto today     = floor<days>(system_clock::now()); | ||||
|    auto today     = floor<days>(util::time::now()); | ||||
|    auto yesterday = today - days {1}; | ||||
| 
 | ||||
|    std::unique_lock lock(p->refreshMutex_); | ||||
|  | @ -388,7 +388,7 @@ void AwsNexradDataProvider::Impl::PruneObjects() | |||
| { | ||||
|    using namespace std::chrono; | ||||
| 
 | ||||
|    auto today     = floor<days>(system_clock::now()); | ||||
|    auto today     = floor<days>(util::time::now()); | ||||
|    auto yesterday = today - days {1}; | ||||
| 
 | ||||
|    std::unique_lock lock(objectsMutex_); | ||||
|  |  | |||
|  | @ -108,7 +108,7 @@ WarningsProvider::LoadUpdatedFiles( | |||
|    std::vector<std::shared_ptr<awips::TextProductFile>> updatedFiles; | ||||
| 
 | ||||
|    const std::chrono::sys_time<std::chrono::hours> now = | ||||
|       std::chrono::floor<std::chrono::hours>(std::chrono::system_clock::now()); | ||||
|       std::chrono::floor<std::chrono::hours>(util::time::now()); | ||||
|    std::chrono::sys_time<std::chrono::hours> currentHour = | ||||
|       (startTime != std::chrono::sys_time<std::chrono::hours> {}) ? | ||||
|          startTime : | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat