Skip to content

Commit 3d618e9

Browse files
committed
add additional logging for computation
1 parent 69421f4 commit 3d618e9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Nudge/UI/Main.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,12 @@ class AppDelegate: NSObject, NSApplicationDelegate {
286286
let safeIndex = max(0, minorVersions.count - (OSVersionRequirementVariables.minorVersionRecalculationThreshold + 1)) // Ensure the index is within bounds
287287
let targetVersion = minorVersions[safeIndex]
288288
var foundVersion = false
289-
LogManager.notice("minorVersionRecalculationThreshold is set - Targeting macOS \(targetVersion) requiredInstallationDate via SOFA", logger: sofaLog)
289+
LogManager.notice("minorVersionRecalculationThreshold is set to \(OSVersionRequirementVariables.minorVersionRecalculationThreshold) - Current Version: \(currentInstalledVersion) - Targeting version \(targetVersion) requiredInstallationDate via SOFA", logger: sofaLog)
290290
for osVersion in macOSSOFAAssets {
291291
for securityRelease in osVersion.securityReleases.reversed() {
292292
if VersionManager.versionGreaterThanOrEqual(currentVersion: securityRelease.productVersion, newVersion: targetVersion) && VersionManager.versionLessThan(currentVersion: currentInstalledVersion, newVersion: targetVersion) {
293293
requiredInstallationDate = securityRelease.releaseDate?.addingTimeInterval(slaExtension) ?? DateManager().getCurrentDate().addingTimeInterval(TimeInterval(90 * 86400))
294+
LogManager.notice("Found target macOS version \(targetVersion) - releaseDate is \(securityRelease.releaseDate!), slaExtension is \(LoggerUtilities().printTimeInterval(slaExtension))", logger: sofaLog)
294295
foundVersion = true
295296
break
296297
}

Nudge/Utilities/Utils.swift

+9
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,15 @@ struct LoggerUtilities {
894894
return PrefsWrapper.requiredMinimumOSVersion == "0.0"
895895
}
896896

897+
func printTimeInterval(_ interval: TimeInterval) -> String {
898+
let days = Int(interval) / (24 * 3600)
899+
let hours = (Int(interval) % (24 * 3600)) / 3600
900+
let minutes = (Int(interval) % 3600) / 60
901+
let seconds = Int(interval) % 60
902+
903+
return "\(days) days, \(hours) hours, \(minutes) minutes, \(seconds) seconds"
904+
}
905+
897906
private func updateDeferralCount(_ count: inout Int, resetCount: Bool, key: String) {
898907
if CommandLineUtilities().demoModeEnabled() {
899908
count = 0

0 commit comments

Comments
 (0)