def current_catalog_snaptime(cur, encode=False):
    """The whole catalog snaptime is the latest transaction of any type.

       Encode:
         False (default): return raw snaptime
         True: encode as a simple URL-safe string as time since EPOCH
    """
    cur.execute("""
SELECT %(prefix)s GREATEST(
  (SELECT ts FROM _ermrest.model_last_modified ORDER BY ts DESC LIMIT 1),
  (SELECT ts FROM _ermrest.table_last_modified ORDER BY ts DESC LIMIT 1)
) %(suffix)s;
""" % {
    'prefix': '_ermrest.tstzencode(' if encode else '',
    'suffix': ')' if encode else '',
})
    return cur.fetchone()[0]