  We consider an inverse problem for a Lorentzian spacetime $(M,g)$, and show
that time measurements, that is, the knowledge of the Lorentzian time
separation function on a submanifold $\Sigma\subset M$ determine the
$C^\infty$-jet of the metric in the Fermi coordinates associated to $\Sigma$.
We use this result to study the global determination of the spacetime $(M,g)$
when it has a real-analytic structure or is stationary and satisfies the
Einstein-scalar field equations. In addition to this, we require that $(M,g)$
is geodesically complete modulo scalar curvature singularities. The results are
Lorentzian counterparts of extensively studied inverse problems in Riemannian
geometry - the determination of the jet of the metric and the boundary rigidity
problem. We give also counterexamples in cases when the assumptions are not
valid, and discuss inverse problems in general relativity.
