Search code examples
utcstrftimeskyfield

How to ts.now().utc_strftime("%H:%M:%S.%f") in skyfield v1.26


I was tracking a satellite every second, but needed a higher sampling rate. So I changed to every 0.25 seconds. I want to print the utc of the sampling to a few decimal places. I tried ts.now().utc_strftime("%H:%M:%S.%f") but it's printing 13:23:18.%f instead of 13:23:18.235.

How do I format ts.now().utc_strftime(<format>) to higher precision than seconds?


Solution

  • Old versions of Skyfield relied internally on Python's own time.strftime() which, alas, lacks support for microseconds. Try upgrading to a more recent version — the current version is 1.30 — and see whether that fixes the problem?