SpaceTime
Astronomical space coordinate and time conversion. Calculate Julian day, local sidereal time and ecliptic obliquity with great precision.
Install / Use
/learn @DJBen/SpaceTimeREADME

SpaceTime
Overview
- Conversion among equatorial coordinate (right ascension and declination), horizontal coordinate (azimuth and altitude), ecliptic coordinate (longitude and latitude) and their corresponding Cartesian equivalents.
- Calculate Julian Day and Local sidereal time.
- High precision calculation of the obliquity of ecliptic good to 0″.04 / 1000 years over 10000 years.
- Matrix / Quaternion transformation from celestial coordinate system to local tangent plane. Supports North-East-Down coordinate from earth-centered, earth-fixed coordinate system for any given longitude, latitude and timestamp.
Demo
You can find a demo project under SpaceTimeDemo directory.
It showcases several useful scenarios.

Installation
Carthage
github "DJBen/SpaceTime" ~> 0.4.0
Usage
Equatorial to horizontal coordinate:
// Supply observer location and timestamp
let locTime = ObserverLocationTime(location: location, timestamp: JulianDay.now)
let vegaCoord = EquatorialCoordinate(rightAscension: radians(hours: 18, minutes: 36, seconds: 56.33635), declination: radians(degrees: 38, minutes: 47, seconds: 1.2802), distance: 1)
// Azimuth and altitude of Vega
let vegaAziAlt = HorizontalCoordinate.init(equatorialCoordinate: vegaCoord, observerInfo: locTime)
Ecliptic coordinate of Pollux at standard equinox of J2000.0.
let ra = DegreeAngle(116.328942)
let dec = DegreeAngle(28.026183)
let eclipticCoord = EclipticCoordinate(longitude: ra, latitude: dec, distance: 1, julianDay: .J2000)
eclipticCoord.longitude.wrappedValue // 113.21563
eclipticCoord.latitude.wrappedValue // 6.68417
Greenwich Mean Sidereal Time:
SiderealTime.init(julianDay: JulianDay.now)
Local Apparent Sidereal Time:
// Get location from GPS or hard code
let locTime = ObserverLocationTime(location: location, timestamp: JulianDay.now)
let localSidTime = SiderealTime.init(observerLocationTime: locTime)
More use cases can be found in the source and test cases.
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
