Explicitly cast seconds to NSTimeInterval in TimeIntervalFromSecondsAndNanos.

This was causing an error in our Github tests (https://github.com/protocolbuffers/protobuf/actions/runs/23308413575/job/67788944664) after Github upgraded its Macos 14 runner images. This likely seems to be due to the upgrade to Clang/LLVM, though the release notes claim the error was actually made *weaker* in 15.0.1 https://reviews.llvm.org/D133800.

Seems like https://github.com/actions/runner-images/issues/13827 is likely mistakenly causing this to surface, but this is an error in Clang16 so we should probably fix it anyways.

PiperOrigin-RevId: 886846312
This commit is contained in:
Sandy Zhang 2026-03-20 09:58:08 -07:00 committed by Copybara-Service
parent 7f7b974fce
commit 28f94045e6

View file

@ -19,7 +19,7 @@ NSString *const GPBWellKnownTypesErrorDomain = GPBNSStringifySymbol(GPBWellKnown
static NSString *kTypePrefixGoogleApisCom = @"type.googleapis.com/";
static NSTimeInterval TimeIntervalFromSecondsAndNanos(int64_t seconds, int32_t nanos) {
return seconds + (NSTimeInterval)nanos / 1e9;
return (NSTimeInterval)seconds + (NSTimeInterval)nanos / 1e9;
}
static int32_t SecondsAndNanosFromTimeInterval(NSTimeInterval time, int64_t *outSeconds,