I have a method calling localtime
that I wrote a unit test for. I seed the call to localtime
in my test so that I know the expected answers. So far, so good. I happen to run the unit test on a machine in a different timezone and, predictably, the tests fail, because they're some # of hours off. I suppose I could dynamically determine the correct expected values but that seems to go against the idea of knowing the answer before asking the question.
Any thoughts on how to approach this? Override localtime
? That seems extreme.
Thanks!