To avoid corner cases like that or effects that are well known to "experts" but not me I always spell out tests as simply and unambiguously as possible with the emphasis on unambiguously. I can generate bugs at quite a rate myself without trying to be clever.
Now, times are especially weird as a data type due to the myriad rules and the modulo effect and to even contemplate trying to squeeze in a notion of one time being true whilst another false looks bloody stupid to me.
It looks to me like the clever buggers who test the existence of a var with if $var are just plain lazy. If it's a common construct then I think it's probably a really stupid one. I think that you are effectively wanting to test a variable's existence by comparing its value with true/false which are two different things.
Surely you should test for "is not null" (or whatever syntax is necessary in the language concerned) which implies existence or test the contents of the variable. Trying to do both at once clearly ends in tears eventually or ends up with strange discussions about date/times that might be true or false
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds