Differentiate between mains and a generator
Frequency stability will probably tell you.

UPS you'd have to characterise but it's likely to be crystal controlled, so highly stable with a small but relatively constant error (within a few ppm of 50/60Hz). 

Mains is subject to short term drift within strict limits : usually within 0.1 or 0.2Hz but occasionally up to 0.5Hz off, but over the longer term (an entire day or more) the error will average out to 0, higher accuracy than the crystal.

The generator is probably much less accurate or stable than either of these.