An emergency ordinance is an ordinance necessary for the immediate preservation of the public peace, health, safety, or welfare in which the emergency is defined and declared in a preamble thereto, and is adopted by a vote of at least three-fourths of the members of the council. No prosecution shall be based upon the provisions of any emergency ordinance until twenty-four (24) hours after the ordinance has been filed with the city clerk and posted in three conspicuous places or until the ordinance has been published, unless the person charged with violation had actual notice of the passage of the ordinance prior to the act or omission complained of.