def getEventTime(cursor, event_id=None, event_time=None, order="DESC"):
    """Get the event time.

    If the event_time is specified, simply return.  Else if the event_id is
    specified, return its time. Else return the most recent event.
    
    Args:
        cursor: Database cursor.
        event_id: Event id.
        event_time: Event time.
        order: ASC or DESC.
    

    Returns:
        The event time string.
    """    
    if event_id == None:
        cursor.execute("SELECT id FROM Event ORDER BY time %s"%order)
        event_id = int(cursor.fetchone()["id"])
    if event_time == None:
        cursor.execute("SELECT time FROM Event WHERE id=%d"%event_id)
        event_time = str(cursor.fetchone()["time"])
    return event_time