A method of calculating an exposure time for disinfecting a room using an ultraviolet disinfecting apparatus, the method comprises measuring distances using a spatial sensor to perform a first scan of a boundary surface of the room, to measure a first set of distances from the sensor to the boundary surface (e.g. a wall) adjusting the height or orientation of the spatial sensor using the sensor to perform a second scan of the boundary surface, to measure a second set of distances from the adjusted sensor to the boundary surface subsequently calculating the exposure time in dependence the sets of distances. Preferably, a further sensor adjustment occurs and a third scan to measure a third set of distances. The method enables the accurate representation of the characteristics of the room, such as furniture and obstructing objects, therefore giving a more accurate exposure time. The apparatus is also claimed. Also disclosed is a method of monitoring failure of an ultraviolet emitter in a UV disinfecting apparatus, comprising sequentially energising each of a plurality of UV emitters measuring the current delivered to them and comparing this to a reference value identifying failure if the combined current is different to the reference value.