  Connes' functional formula of the Riemannian distance is generalized to the
Lorentzian case using the so-called Lorentzian distance, the d'Alembert
operator and the causal functions of a globally hyperbolic spacetime. As a step
of the presented machinery, a proof of the almost-everywhere smoothness of the
Lorentzian distance considered as a function of one of the two arguments is
given. Afterwards, using a $C^*$-algebra approach, the spacetime causal
structure and the Lorentzian distance are generalized into noncommutative
structures giving rise to a Lorentzian version of part of Connes'
noncommutative geometry. The generalized noncommutative spacetime consists of a
direct set of Hilbert spaces and a related class of $C^*$-algebras of
operators. In each algebra a convex cone made of self-adjoint elements is
selected which generalizes the class of causal functions. The generalized
events, called {\em loci}, are realized as the elements of the inductive limit
of the spaces of the algebraic states on the $C^*$-algebras. A partial-ordering
relation between pairs of loci generalizes the causal order relation in
spacetime. A generalized Lorentz distance of loci is defined by means of a
class of densely-defined operators which play the r\^ole of a Lorentzian
metric. Specializing back the formalism to the usual globally hyperbolic
spacetime, it is found that compactly-supported probability measures give rise
to a non-pointwise extension of the concept of events.
