It seems that checking if it's xx:00:00 UTC/GMT is as simple as checking if timestamp % 3600 == 0
, with timestamp = number of seconds elapsed since epoch (1970-01-01 00:00:00). We can see it here:
import datetime
print datetime.datetime.fromtimestamp(3600*24*17000)
# 2016-07-18 02:00:00
But isn't this in contradiction with leap seconds? Indeed, the number of seconds elapsed between 1970-01-01 00:00:00 and 2016-07-18 02:00:00 is not a multiple of 3600, but a multiple of 3600 + 26 leap seconds (there have been 26 leap seconds between 1972 and now).
To be more precise: the number of elapsed seconds between 1970-01-01 00:00:00 and 2016-07-18 02:00:00 is 3600*24*17000 + 26
and not 3600*24*17000
.