'Counts the number of users who used this homeserver in the last 24 hours.'

@defer.inlineCallbacks
def count_daily_users(self):

    def _count_users(txn):
        yesterday = ((int(self._clock.time_msec()) - (((1000 * 60) * 60) * 24)),)
        sql = '\n                                                                SELECT    COALESCE(count(*),    0)    FROM    (\n                                                                                SELECT    user_id    FROM    user_ips\n                                                                                WHERE    last_seen    >    ?\n                                                                                GROUP    BY    user_id\n                                                                )    u\n                                                '
        txn.execute(sql, (yesterday,))
        (count,) = txn.fetchone()
        return count
    ret = (yield self.runInteraction('count_users', _count_users))
    defer.returnValue(ret)
