We define an indefinite theta function in dimension g and index 1 whose modular parameter transforms by a symplectic group, generalizing a construction of Sander Zwegers used in the theory of mock modular forms.We introduce the indefinite zeta function, defined from the indefinite theta function using a Mellin transform, and prove its analytic continuation and functional equation.We express certain zeta functions attached to ray ideal classes of real quadratic fields as indefinite zeta functions (up to gamma factors).A Kronecker limit formula for the indefinite zeta function---and by corollary, for real quadratic fields---is obtained at s=1.Finally, we discuss two applications related to Hilbert;;s 12th problem: numerical computation of Stark units in the rank 1 real quadratic case, and computation of fiducial vectors of Heisenberg SIC-POVMs.