Datetime printing
Closed this issue · 0 comments
ewenmaclean commented
this currently ipads to 3 correctly but doesn't cut off at 3 - e.g. with the millisec field as Some 5838
it prints .5838
rather than .584
....
https://github.com/AestheticIntegration/fix-engine/blob/master/src-core-pp/encode_datetime.iml#L41
this is ugly but works - @KKostya what do you think?
let encode_UTCTimeOnly_milli (x:fix_utctimeonly_milli ) : string =
let hms = Printf.sprintf "%02u:%02u:%02u"
(Z.to_int x.utc_timeonly_hour)
(Z.to_int x.utc_timeonly_minute)
(Z.to_int x.utc_timeonly_second)
in
match x.utc_timeonly_millisec with
| None -> hms
| Some ms -> hms
^ (String.sub (Printf.sprintf ".%3d" (Z.to_int ms)) 0 4 |>
function
| None -> ""
| Some s -> s)
;;