···120120 match Ptime.of_float_s unix_t with
121121 | Some t ->
122122 let (y, m, d), ((hh, mm, ss), _) = Ptime.to_date_time ~tz_offset_s:0 t in
123123- Printf.sprintf "%04d-%02d-%02d %02d:%02d:%02d UTC" y m d hh mm ss
124124- | None -> Printf.sprintf "%.0f" unix_t
123123+ Fmt.str "%04d-%02d-%02d %02d:%02d:%02d UTC" y m d hh mm ss
124124+ | None -> Fmt.str "%.0f" unix_t
125125126126let format_duration secs =
127127 let m = int_of_float secs / 60 in
128128 let s = int_of_float secs mod 60 in
129129- Printf.sprintf "%dm%02ds" m s
129129+ Fmt.str "%dm%02ds" m s
130130131131let el_bar max_el =
132132 let n = int_of_float (max_el /. 90.0 *. 20.0) in
···161161 [
162162 format_time p.aos_time;
163163 format_time p.los_time;
164164- Printf.sprintf "%.1f" p.max_elevation;
164164+ Fmt.str "%.1f" p.max_elevation;
165165 format_duration p.duration;
166166 ]
167167 t)
+1-1
lib/contact.ml
···1717let unix_to_epoch unix_t =
1818 match Ptime.of_float_s unix_t with
1919 | Some t -> Ptime.to_rfc3339 ~tz_offset_s:0 t
2020- | None -> Printf.sprintf "%.0f" unix_t
2020+ | None -> Fmt.str "%.0f" unix_t
21212222(* Compute satellite elevation from a ground station.
2323 Uses SGP4 (TEME) -> ECEF -> topocentric. *)
+4-4
test/test.ml
···2424let test_predict_passes () =
2525 let tle = parse_tle () in
2626 let passes = Contact.predict tle la ~duration_days:3.0 in
2727- Printf.printf " Found %d passes over LA in 3 days\n" (List.length passes);
2727+ Fmt.pr " Found %d passes over LA in 3 days\n" (List.length passes);
2828 List.iteri
2929 (fun i p ->
3030- Printf.printf " %2d: %s max_el=%.1f deg dur=%.0fs\n" (i + 1)
3030+ Fmt.pr " %2d: %s max_el=%.1f deg dur=%.0fs\n" (i + 1)
3131 p.Contact.aos_epoch p.max_elevation p.duration)
3232 passes;
3333 (* GMAT found 14 passes. Our SGP4-based prediction may differ slightly
···6161 match Contact.elevation tle la epoch_unix with
6262 | None -> Alcotest.fail "elevation returned None"
6363 | Some el ->
6464- Printf.printf " Elevation at epoch: %.1f deg\n" el;
6464+ Fmt.pr " Elevation at epoch: %.1f deg\n" el;
6565 (* Should be a valid angle *)
6666 Alcotest.(check bool) "valid elevation" true (el >= -90.0 && el <= 90.0)
6767···7979 let passes =
8080 Contact.predict tle la ~duration_days:1.0 ~min_elevation:10.0
8181 in
8282- Printf.printf " Equatorial sat passes over LA (>10 deg): %d\n"
8282+ Fmt.pr " Equatorial sat passes over LA (>10 deg): %d\n"
8383 (List.length passes);
8484 (* Should find 0 or very few passes *)
8585 Alcotest.(check bool) "few/no passes" true (List.length passes <= 2)