Where an "offence is committed by an omission to perform an act that by law there is a duty to perform" (s 4.3(b) of the Criminal Code (Cth), in the form it was at the time relevant to Director of Public Prosecutions (Cth) v Keating  HCA 20 (8 May 2013)), the duty must exist at the time of the commission of an alleged offence. So much is clear from the use of the present tense, as the High Court of Australia unanimously held in Keating at .
The offences alleged in Keating, essentially failure to inform the Social Security department of changes in circumstances that may have been relevant to entitlement to receipt of benefit payments, were against s 135.2(1) of the Code. The requirement there, of engaging in prohibited conduct, was that there must be a duty not to omit to disclose the relevant information. A duty of disclosure was introduced (as a result of DPP (Cth) v Poniatowska, noted here on 27 October 2011) by legislation having retrospective effect, but the existence of retrospective effect did not of itself mean that it engaged with the provisions creating the relevant offence: Keating at .
" It is not to the point to observe that ignorance of the law affords no excuse or that the prosecution is not required to prove an intention to breach a legal duty. The submission ignores that the failure to do a thing is not an offence in the absence of a legal duty to do the thing [footnote 35: "Code, s 4.3(b)"]]. As explained in Poniatowska, s 4.3 of the Code is a reflection of an idea that is fundamental to criminal responsibility: that the criminal law should be certain and its reach ascertainable by those who are subject to it [footnote 36: "[Poniatowska]  HCA 43; (2011) 244 CLR 408 at 424  per French CJ, Gummow, Kiefel and Bell JJ; and see Glanville Williams, Criminal Law: The General Part, 2nd ed (1961) at 579-580; Ashworth, "Public Duties and Criminal Omissions: Some Unresolved Questions",  Journal of Commonwealth Criminal Law 1"]. This idea underpins the strength of the presumption against retrospectivity in the interpretation of statutes that impose criminal liability. Mr Bennion explains the principle in this way [footnote 37; "Bennion on Statutory Interpretation, 5th ed (2008) at 807 (footnotes omitted)"]:
"A person cannot rely on ignorance of the law and is required to obey the law. It follows that he or she should be able to trust the law and that it should be predictable. A law that is altered retrospectively cannot be predicted. If the alteration is substantive it is therefore likely to be unjust. It is presumed that Parliament does not intend to act unjustly."
So in Keating the new legislation, aimed at overcoming the difficulty identified in Poniatowska, was inadequately drafted to overcome the presumption against unjust legislative intent. It did not render s 4.3(b) of the Code nugatory. It did not make a person criminally liable for past failure to perform what was not then an obligation.