Skip to content

Add support for custom time/calendar definitions #45

@Walden95

Description

@Walden95

KSPTOT correctly uses UT seconds internally, but the Kerbin/Earth time display and any UI fields that accept "days/years"
assume stock constants (Kerbin: 21600 s/day, 9201600 s/year). In modded installs (Sigma Dimensions dayLengthMultiplier,
rescale systems, Kronometer calendar changes), these conversions become incorrect/misleading even though UT remains correct. It is especially annoying when an input field requires days as units as this requires manual conversion.

Proposed change
Allow loading an optional custom time system definition from bodies.ini (new [Time] section) or an optional time.ini.
Fields:

  • system = kerbin_stock | earth_stock | custom
  • secondsPerDay
  • secondsPerYear

Popular Configuration Examples
Stock Kerbin: 21,600 s/day, 9,201,600 s/year (426 x 6h days)
Stock Earth: 86,400 s/day, 31,536,000 s/year
JNSQ (native ~2.7x): 43,200 s/day (12h), 15,768,000 s/year (365 × 12h days)
JNSQ Rescale 10x (≈real scale): 86,400 s/day (24h), 31,536,000 s/year (365 × 24h days)
JNSQ Rescale 1x (≈stock scale): 21,600 s/day (6h), 9,972,540 s/year (Computed from the cited breakdown: 461 × 21,600 + 4:09:18.8 ≈ 9,972,540)
Rescale! 2.5x: 36,000 s/day (10h), 14,544,000 s/year (404 × 10h days)
Rescale! 3.2x: 43,200 s/day (12h), 16,459,200 s/year (381 × 12h days) (My Config)
Rescale! 6.4x: 64,800 s/day (18h), 23,284,800 s/year (359 × 18h days)
Rescale! 10x: 86,400 s/day (24h), 29,116,800 s/year (337 × 24h days)
Rescale! 10.625x: 86,400 s/day (24h), 29,980,800 s/year (347 × 24h days)

Notice that I may be wrong on these values, especially since leap years are a thing in Kronometer, but it should be close enough.

No idea how you would implement it via your mod, but if Kronometer is present, treat it as the source-of-truth to import since your mod already has a method to imports bodies from the game.

Example time.ini:

[Time]
; built-ins: kerbin_stock, earth_stock, custom
system = custom

; base conversion constants used ONLY for UI + "days/years" entry fields.
; UT seconds remains the truth for propagation.
secondsPerDay = 43200
secondsPerYear = 16459200

; optional: purely display/formatting preferences
hoursPerDay = 12
minutesPerHour = 60
secondsPerMinute = 60

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions