cFE Time Services

We're working on a video! In the meantime, we hope the text below helps.

 

Motivation

People who have launched and operated spacecraft all agree: Getting the time correct is incredibly difficult. It's so difficult and tricky to keep everything on time that it bears repeating in bold letters:

 

Do not underestimate how hard it is to work with time on spacecraft

 

People who say "time is easy" are probably people without much experience.

Consider a "simple" problem like taking a picture from a satellite traveling at 8 kilometers per second:

- First, if you know you want to take a picture of a specific location, you may have to take the shot within milliseconds of passing over the location. If your system is busy doing other things, you could miss the whole thing. You need a way for the system to interrupt low priority things with high priority "do it now!" actions and that requires knowing precisely when is "now".

- When you tell the camera to take the picture "right now!", it can take a few milliseconds for the code to send the instructions. And it takes more time for the camera to read the detector and send the data back to you. So when was the picture really taken? The truth is somewhere between when you told the camera to take it and when the data showed up.

- You need to know exactly when you took it and match it with your pointing information so you can map it all correctly. This can be like you looking at the nearest clock and saying the time out loud to the nearest second. By the time you say it, it's not really that time anymore. The delay in communicating the time has made it invalid. This is a common problem for programs that must timestamp data. By the time you get the time, send it to the function, put it in the packet, and save it, time has elapsed. Your picture could be offset from its real location on Earth by a kilometer or more.

- What if you want to take a picture every second, no matter what? This is hard for systems to achieve. Even popular operating systems like Microsoft Windows struggle to do "exactly one second". It's usually off by a handful of milliseconds. That doesn't matter when you're browsing the Internet but if you're flying at 8 kilometers per second, every millisecond is eight meters. Just 10 milliseconds of error is almost a soccer or football field of position error.

These are just a few problems. People who have been doing this for a while have lots of horror stories of timing gone wrong. (This author has seen programs spend weeks and hundreds of thousands of dollars trying to recover from timing problems measured in milliseconds)

 

The Timing Service

NASA has had lots of its own issues with timing so they put a lot of effort into making the service as simple as possible to use. Because it's so critical to everything, it lives in the Core Flight Executive layer with all the fundamental services. With it you can:

- Ask what time it is

- Ask it to tell you what time it is in one second

- Ask it to send you a pulse every second

- Keep track of different time zones, including thinking about leap seconds

- Makes sure the time is accurate even if your computer has to restart

The deeper you get into making a real spaceflight mission, the more you'll appreciate this service!

 

Quick Notes

- Even with the Timing Service, your timing solution depends a lot on the avionics hardware you're using. Some hardware does a better job of supporting timing needs than others.

- In the code, you'll see the services shortened to just "TIME"