Format to show time since last screen lock / unlock event

This is actually a two-part question. I'm using $tf(df(S) - df(S, si(locked)))$ to try and show the time since last unlock event but it only returns 5 decades. Is this even a possible argument? Second, the reason I'm doing this is I have a gif set to show on unlock that slowly fades out and scales out but once that happens the gif reappears and stays on screen as a normal komponent. Once it fades and scales out, I want it to stay gone until the next unlock event so my thought was to add opacity if condition of "if screen has been unlocked for more than 5 seconds then opacity 0 else 100. I may be way over complicating this or it may not even be possible. Any help would be appreciated, thank you in advance