Skip to content

COMP: Remove conversion warnings after floor in RealTimeClock - #6567

Merged
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
SimonRit:win_timestamp_floor
Jul 8, 2026
Merged

COMP: Remove conversion warnings after floor in RealTimeClock#6567
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
SimonRit:win_timestamp_floor

Conversation

@SimonRit

@SimonRit SimonRit commented Jul 8, 2026

Copy link
Copy Markdown

This addresses the following two warnings:

C:\src\itk\ITK-main\Modules\Core\Common\src\itkRealTimeClock.cxx(113):
    warning C4244: '=': conversion from 'double' to 'SecondsCounterType', possible loss of data
C:\src\itk\ITK-main\Modules\Core\Common\src\itkRealTimeClock.cxx(114):
    warning C4244: '=': conversion from 'double' to 'MicroSecondsCounterType', possible loss of data

See main branch build with warnings and this PR build without warnings.

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

This addresses the following two warnings:
```
C:\src\itk\ITK-main\Modules\Core\Common\src\itkRealTimeClock.cxx(113):
    warning C4244: '=': conversion from 'double' to 'SecondsCounterType', possible loss of data
C:\src\itk\ITK-main\Modules\Core\Common\src\itkRealTimeClock.cxx(114):
    warning C4244: '=': conversion from 'double' to 'MicroSecondsCounterType', possible loss of data
```
@github-actions github-actions Bot added type:Compiler Compiler support or related warnings area:Core Issues affecting the Core module labels Jul 8, 2026
@greptile-apps

greptile-apps Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates the Windows timestamp conversion in RealTimeClock. The main changes are:

  • Replaces std::floor with typed itk::Math::Floor<T> calls.
  • Removes MSVC narrowing conversion warnings for seconds and microseconds counters.
  • Leaves the public API and non-Windows code path unchanged.

Confidence Score: 5/5

Safe to merge with minimal risk.

The change is small and localized, and it preserves the existing floor-and-convert behavior through ITK's typed math helper.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • The narrow syntax check for the realtimeclock module was attempted but blocked by a missing itkConfigure.h.
  • The pre-PR code path at lines 113-114 contained two direct std::floor assignments to counter types, as seen in the static-before log.
  • The current checkout uses itk::Math::Floor<SecondsCounterType> and itk::Math::Floor<MicroSecondsCounterType> at lines 113-114, and the related assertions pass.
  • Toolchain verification shows available local commands and confirms that CMake, Ninja, and MSVC are not on PATH.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
Modules/Core/Common/src/itkRealTimeClock.cxx Updates the Windows RealTimeStamp conversion to use typed itk::Math::Floor calls without changing timestamp construction semantics.

Reviews (1): Last reviewed commit: "COMP: Remove conversion warnings after f..." | Re-trigger Greptile

@hjmjohnson
hjmjohnson merged commit e46eb72 into InsightSoftwareConsortium:main Jul 8, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Core Issues affecting the Core module type:Compiler Compiler support or related warnings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants